Use hardhat-exposed to reduce the need for mocks (#3666)

Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
Hadrien Croubois
2023-01-03 15:38:13 +01:00
committed by GitHub
parent a81b0d0b21
commit c1d9da4052
190 changed files with 2297 additions and 4311 deletions

View File

@ -1,33 +1,33 @@
const { expect } = require('chai');
const Base64Mock = artifacts.require('Base64Mock');
const Base64 = artifacts.require('$Base64');
contract('Strings', function () {
beforeEach(async function () {
this.base64 = await Base64Mock.new();
this.base64 = await Base64.new();
});
describe('from bytes - base64', function () {
it('converts to base64 encoded string with double padding', async function () {
const TEST_MESSAGE = 'test';
const input = web3.utils.asciiToHex(TEST_MESSAGE);
expect(await this.base64.encode(input)).to.equal('dGVzdA==');
expect(await this.base64.$encode(input)).to.equal('dGVzdA==');
});
it('converts to base64 encoded string with single padding', async function () {
const TEST_MESSAGE = 'test1';
const input = web3.utils.asciiToHex(TEST_MESSAGE);
expect(await this.base64.encode(input)).to.equal('dGVzdDE=');
expect(await this.base64.$encode(input)).to.equal('dGVzdDE=');
});
it('converts to base64 encoded string without padding', async function () {
const TEST_MESSAGE = 'test12';
const input = web3.utils.asciiToHex(TEST_MESSAGE);
expect(await this.base64.encode(input)).to.equal('dGVzdDEy');
expect(await this.base64.$encode(input)).to.equal('dGVzdDEy');
});
it('empty bytes', async function () {
expect(await this.base64.encode([])).to.equal('');
expect(await this.base64.$encode([])).to.equal('');
});
});
});