@0x/contracts-test-utils
: Make blockchainTests()
automatically call blockchainLifecycle.startAsync()
and blockchainLifecycle.revertAsync()
in a before()
and after()
directive.
This commit is contained in:
parent
9792246970
commit
99e242affd
@ -80,7 +80,18 @@ function defineBlockchainSuite<T>(
|
|||||||
describeCall: Mocha.ContextDefinitionCallback<T>,
|
describeCall: Mocha.ContextDefinitionCallback<T>,
|
||||||
): T {
|
): T {
|
||||||
return describeCall(description, function(this: Mocha.ISuiteCallbackContext): void {
|
return describeCall(description, function(this: Mocha.ISuiteCallbackContext): void {
|
||||||
callback.call(this, BlockchainTestsEnvironment.create());
|
const env = BlockchainTestsEnvironment.create();
|
||||||
|
before(
|
||||||
|
async (): Promise<void> => {
|
||||||
|
return env.blockchainLifecycle.startAsync();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
before(
|
||||||
|
async (): Promise<void> => {
|
||||||
|
return env.blockchainLifecycle.revertAsync();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
callback.call(this, env);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ blockchainTests('mocha blockchain extensions', env => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
blockchainTests/*.only*/('only', () => {
|
blockchainTests('only', () => {
|
||||||
it.skip("can't test `only` :-(", () => {
|
it.skip("can't test `only` :-(", () => {
|
||||||
// no-op.
|
// no-op.
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user