Skip to content
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

Commit 1c1fea2

Browse files
committed
fixup! feat: Support Ethereum EIP-712 Sign Typed Data
Remove bigint/string integer tests from integration tests. These tests are now made in unit tests instead.
1 parent be4e076 commit 1c1fea2

File tree

1 file changed

+15
-37
lines changed

1 file changed

+15
-37
lines changed
Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,23 @@
11
import commonFixtures from '../../submodules/trezor-common/tests/fixtures/ethereum/sign_typed_data.json';
22

3-
const commonFixturesTests = commonFixtures.tests.flatMap(({ name, parameters, result }) => {
4-
const fixture = {
5-
description: `${name} ${parameters.comment ?? ''}`,
6-
name,
7-
params: {
8-
...parameters,
9-
metamaskV4Compatibility: parameters.metamask_v4_compat,
10-
},
11-
result: {
12-
address: result.address,
13-
signature: result.sig,
14-
},
15-
};
16-
return fixture;
17-
});
18-
19-
const [complexDataFixture] = commonFixturesTests.filter(({ name }) => name === 'complex_data');
20-
21-
// Make sure we test whether bigint or string numbers works correctly
22-
function intAsString(x) {
23-
return `${x}`;
24-
}
25-
// BigInt is defined in all modern environments
26-
// eslint-disable-next-line no-undef
27-
const testNumberFormats = [BigInt, intAsString].map(makeBigNumber => {
28-
const fixture = JSON.parse(JSON.stringify(complexDataFixture));
29-
fixture.description = `${fixture.description} - ${makeBigNumber.name}`;
30-
31-
const { message } = fixture.params.data;
32-
message.from.karma = makeBigNumber(message.from.karma);
33-
message.from.kids = makeBigNumber(message.from.kids);
34-
message.to.karma = makeBigNumber(message.to.karma);
35-
message.to.kids = makeBigNumber(message.to.kids);
36-
return fixture;
37-
});
38-
393
export default {
404
method: 'ethereumSignTypedData',
415
setup: {
426
mnemonic: commonFixtures.setup.mnemonic,
437
},
44-
tests: [...commonFixturesTests, ...testNumberFormats],
8+
tests: commonFixtures.tests.flatMap(({ name, parameters, result }) => {
9+
const fixture = {
10+
description: `${name} ${parameters.comment ?? ''}`,
11+
name,
12+
params: {
13+
...parameters,
14+
metamaskV4Compatibility: parameters.metamask_v4_compat,
15+
},
16+
result: {
17+
address: result.address,
18+
signature: result.sig,
19+
},
20+
};
21+
return fixture;
22+
}),
4523
};

0 commit comments

Comments
 (0)