Migrate from truffle to test-environment (#2007)
* Sketch * Migrate all tests to test-env * Finish migration to test-env * Add config * Work on GSN tests * Migrate to newer test-env version and loader syntax * Add GSN setup * Finish test-env migration * Setup coverage using test-env * Migrate to npm package * Fix package.json * Add compile step to CI * Add comment on coverage setup * Remove dependency on @truffle/contract * Fix package-lock merge * Fix linter errors * Upgrade test-environment, depend locally on ganche-coverage * Improve coverage script * Improve sign.js API * Move accounts destructuring to describe block * Switch to prebuilt ethereumjs-vm package * Upgrade test-enviroment version * use workspace in circleci config * remove unnecessary npx
This commit is contained in:
committed by
Francisco Giordano
parent
ca6a5dc8a2
commit
5f92adc2e7
@ -1,15 +1,19 @@
|
||||
const { accounts, contract, web3 } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { constants, expectRevert } = require('@openzeppelin/test-helpers');
|
||||
const { ZERO_ADDRESS } = constants;
|
||||
const { toEthSignedMessageHash, fixSignature } = require('../helpers/sign');
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const ECDSAMock = artifacts.require('ECDSAMock');
|
||||
const ECDSAMock = contract.fromArtifact('ECDSAMock');
|
||||
|
||||
const TEST_MESSAGE = web3.utils.sha3('OpenZeppelin');
|
||||
const WRONG_MESSAGE = web3.utils.sha3('Nope');
|
||||
|
||||
contract('ECDSA', function ([_, other]) {
|
||||
describe('ECDSA', function () {
|
||||
const [ other ] = accounts;
|
||||
|
||||
beforeEach(async function () {
|
||||
this.ecdsa = await ECDSAMock.new();
|
||||
});
|
||||
@ -142,7 +146,7 @@ contract('ECDSA', function ([_, other]) {
|
||||
|
||||
context('toEthSignedMessage', function () {
|
||||
it('should prefix hashes correctly', async function () {
|
||||
(await this.ecdsa.toEthSignedMessageHash(TEST_MESSAGE)).should.equal(toEthSignedMessageHash(TEST_MESSAGE));
|
||||
expect(await this.ecdsa.toEthSignedMessageHash(TEST_MESSAGE)).to.equal(toEthSignedMessageHash(TEST_MESSAGE));
|
||||
expect(await this.ecdsa.toEthSignedMessageHash(TEST_MESSAGE)).to.equal(toEthSignedMessageHash(TEST_MESSAGE));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user