`@0x/contracts-exchange-libs: Appease the linter and prettier gods.

This commit is contained in:
Lawrence Forman
2019-08-02 13:30:48 -04:00
parent 4711ce5532
commit 6345faa4a9
20 changed files with 334 additions and 465 deletions

View File

@@ -28,8 +28,9 @@ describe('testWithReferenceFuncAsync', () => {
});
it('fails when both succeed and actual != expected', async () => {
return expect(testWithReferenceFuncAsync(alwaysValueFunc(3), divAsync, [1, 2]))
.to.be.rejectedWith('{"x":1,"y":2}: expected 0.5 to deeply equal 3');
return expect(testWithReferenceFuncAsync(alwaysValueFunc(3), divAsync, [1, 2])).to.be.rejectedWith(
'{"x":1,"y":2}: expected 0.5 to deeply equal 3',
);
});
it('passes when both fail and error messages are the same', async () => {
@@ -44,9 +45,7 @@ describe('testWithReferenceFuncAsync', () => {
const notError = new Error(notErrorMessage);
return expect(
testWithReferenceFuncAsync(alwaysFailFunc(notError), alwaysFailFunc(error), [1, 2]),
).to.be.rejectedWith(
`{"x":1,"y":2}: expected error message '${errorMessage}' to equal '${notErrorMessage}'`,
);
).to.be.rejectedWith(`{"x":1,"y":2}: expected error message '${errorMessage}' to equal '${notErrorMessage}'`);
});
it('passes when both fail with compatible RevertErrors', async () => {
@@ -58,34 +57,32 @@ describe('testWithReferenceFuncAsync', () => {
it('fails when both fail with incompatible RevertErrors', async () => {
const error1 = new StringRevertError('whoopsie');
const error2 = new StringRevertError('not whoopsie');
return expect(testWithReferenceFuncAsync(alwaysFailFunc(error1), alwaysFailFunc(error2), [1, 1]))
.to.be.rejectedWith(
`{"x":1,"y":1}: expected error StringRevertError({ message: 'not whoopsie' }) to equal StringRevertError({ message: 'whoopsie' })`,
);
return expect(
testWithReferenceFuncAsync(alwaysFailFunc(error1), alwaysFailFunc(error2), [1, 1]),
).to.be.rejectedWith(
`{"x":1,"y":1}: expected error StringRevertError({ message: 'not whoopsie' }) to equal StringRevertError({ message: 'whoopsie' })`,
);
});
it('fails when reference function fails with a RevertError but test function fails with a regular Error', async () => {
const error1 = new StringRevertError('whoopsie');
const error2 = new Error('whoopsie');
return expect(testWithReferenceFuncAsync(alwaysFailFunc(error1), alwaysFailFunc(error2), [1, 1]))
.to.be.rejectedWith(
`{"x":1,"y":1}: expected a RevertError but received an Error`,
);
return expect(
testWithReferenceFuncAsync(alwaysFailFunc(error1), alwaysFailFunc(error2), [1, 1]),
).to.be.rejectedWith(`{"x":1,"y":1}: expected a RevertError but received an Error`);
});
it('fails when referenceFunc succeeds and testFunc fails', async () => {
const error = new Error('whoopsie');
return expect(testWithReferenceFuncAsync(alwaysValueFunc(0), alwaysFailFunc(error), [1, 2]))
.to.be.rejectedWith(
`{"x":1,"y":2}: expected success but instead failed`,
);
return expect(testWithReferenceFuncAsync(alwaysValueFunc(0), alwaysFailFunc(error), [1, 2])).to.be.rejectedWith(
`{"x":1,"y":2}: expected success but instead failed`,
);
});
it('fails when referenceFunc fails and testFunc succeeds', async () => {
const error = new Error('whoopsie');
return expect(testWithReferenceFuncAsync(alwaysFailFunc(error), divAsync, [1, 2]))
.to.be.rejectedWith(
'{"x":1,"y":2}: expected failure but instead succeeded',
);
return expect(testWithReferenceFuncAsync(alwaysFailFunc(error), divAsync, [1, 2])).to.be.rejectedWith(
'{"x":1,"y":2}: expected failure but instead succeeded',
);
});
});