Transpile 7bce2b72

This commit is contained in:
github-actions
2022-01-13 23:13:57 +00:00
commit 37c366503e
465 changed files with 80758 additions and 0 deletions

29
test/utils/Base64.test.js Normal file
View File

@ -0,0 +1,29 @@
const { expect } = require('chai');
const Base64Mock = artifacts.require('Base64Mock');
contract('Strings', function () {
beforeEach(async function () {
this.base64 = await Base64Mock.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==');
});
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=');
});
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');
});
});
});