forked from heyxyz/hey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetSignature.spec.ts
36 lines (31 loc) · 998 Bytes
/
getSignature.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { describe, expect, test } from 'vitest';
import getSignature from './getSignature';
describe('getSignature', () => {
test('should return an object with domain, types, and value keys', () => {
const result = getSignature({
domain: {},
types: {
Post: []
},
value: {}
});
expect(result).toHaveProperty('domain');
expect(result).toHaveProperty('types');
expect(result).toHaveProperty('message');
expect(result.primaryType).toEqual('Post');
});
test('should remove __typename property from domain, types, and value properties', () => {
const input = {
domain: { __typename: 'Domain', key: 'value' },
types: { __typename: 'Types', key: 'value' },
value: { __typename: 'Value', key: 'value' }
};
const result = getSignature(input);
expect(result).toEqual({
domain: { key: 'value' },
message: { key: 'value' },
primaryType: 'key',
types: { key: 'value' }
});
});
});