juggling some files around
This commit is contained in:
@@ -15,7 +15,7 @@ export {
|
||||
export { getLatestBlockTimestampAsync, increaseTimeAndMineBlockAsync } from './block_timestamp';
|
||||
export { provider, txDefaults, web3Wrapper } from './web3_wrapper';
|
||||
export { LogDecoder } from './log_decoder';
|
||||
export { filterLogs, filterLogsToArguments } from './log_utils';
|
||||
export { filterLogs, filterLogsToArguments, verifyEvents } from './log_utils';
|
||||
export { signingUtils } from './signing_utils';
|
||||
export { orderUtils } from './order_utils';
|
||||
export { typeEncodingUtils } from './type_encoding_utils';
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { LogEntry, LogWithDecodedArgs } from 'ethereum-types';
|
||||
import { LogEntry, LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
|
||||
import { expect } from './chai_setup';
|
||||
|
||||
// tslint:disable no-unnecessary-type-assertion
|
||||
|
||||
@@ -15,3 +17,18 @@ export function filterLogs<TEventArgs>(logs: LogEntry[], event: string): Array<L
|
||||
export function filterLogsToArguments<TEventArgs>(logs: LogEntry[], event: string): TEventArgs[] {
|
||||
return filterLogs<TEventArgs>(logs, event).map(log => log.args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that a transaction emitted the expected events of a particular type.
|
||||
*/
|
||||
export function verifyEvents<TEventArgs>(
|
||||
txReceipt: TransactionReceiptWithDecodedLogs,
|
||||
expectedEvents: TEventArgs[],
|
||||
eventName: string,
|
||||
): void {
|
||||
const logs = filterLogsToArguments<TEventArgs>(txReceipt.logs, eventName);
|
||||
expect(logs.length).to.eq(expectedEvents.length);
|
||||
logs.forEach((log, index) => {
|
||||
expect(log).to.deep.equal(expectedEvents[index]);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user