In @0x/utils: Add AnyRevertError type that matches with any revert error

This commit is contained in:
Lawrence Forman
2019-04-04 15:12:44 -04:00
committed by Amir Bandeali
parent abb71cd074
commit 703a0fde3c
4 changed files with 65 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
import * as chai from 'chai';
import { RevertError, StringRevertError } from '../src/revert_error';
import { AnyRevertError, RevertError, StringRevertError } from '../src/revert_error';
import { chaiSetup } from './utils/chai_setup';
@@ -35,6 +35,11 @@ describe('RevertError', () => {
const revert2 = new StringRevertError();
expect(revert1.equals(revert2)).to.be.true();
});
it('should equate AnyRevertError with a real RevertError', () => {
const revert1 = new StringRevertError(message);
const revert2 = new AnyRevertError();
expect(revert1.equals(revert2)).to.be.true();
});
it('should not equate a the same RevertError type with different values', () => {
const revert1 = new StringRevertError(message);
const revert2 = new StringRevertError(`${message}1`);