Skip to content

Commit

Permalink
Add failing tests, demonstrating more bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgall committed Feb 10, 2024
1 parent 3b5e9ec commit 9caba46
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/encodeFunction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,27 @@ test('Function encoding with [uint8=100]', () => {
const encoded = new utils.Interface(['function foo(uint8)']).encodeFunctionData('foo', [100]);
expect(encodeFunction('foo', 'uint8', '100')).toEqual(encoded);
});

test('Function encoding with [string="true"]', () => {
const encoded = new utils.Interface(['function foo(string)']).encodeFunctionData('foo', ['true']);
expect(encodeFunction('foo', 'string', 'true')).toEqual(encoded);
});

test('Function encoding with [string="false"]', () => {
const encoded = new utils.Interface(['function foo(string)']).encodeFunctionData('foo', [
'false',
]);
expect(encodeFunction('foo', 'string', 'false')).toEqual(encoded);
});

test('Function encoding with [string=""', () => {
const encoded = new utils.Interface(['function foo(string)']).encodeFunctionData('foo', ['']);
expect(encodeFunction('foo', 'string', '')).toEqual(encoded);
});

test('Function encoding with [string="hello, world"', () => {
const encoded = new utils.Interface(['function foo(string)']).encodeFunctionData('foo', [
'hello, world',
]);
expect(encodeFunction('foo', 'string', 'hello, world')).toEqual(encoded);
});

0 comments on commit 9caba46

Please sign in to comment.