-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathkeys.test.ts
64 lines (54 loc) · 1.73 KB
/
keys.test.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { describe, expect, it } from 'vitest';
import {
generateSpendKey,
getAddressByIndex,
getEphemeralByIndex,
getFullViewingKey,
getWalletId,
} from './keys.js';
describe('keys', () => {
const seedPhrase =
'benefit cherry cannon tooth exhibit law avocado spare tooth that amount pumpkin scene foil tape mobile shine apology add crouch situate sun business explain';
describe('generateSpendKey()', () => {
it('does not raise zod validation error', () => {
expect(() => {
generateSpendKey(seedPhrase);
}).not.toThrow();
});
});
describe('generateFullViewingKey()', () => {
it('does not raise zod validation error', () => {
const spendKey = generateSpendKey(seedPhrase);
expect(() => {
getFullViewingKey(spendKey);
}).not.toThrow();
});
});
describe('generateAddressByIndex()', () => {
it('does not raise zod validation error', () => {
const spendKey = generateSpendKey(seedPhrase);
const fullViewingKey = getFullViewingKey(spendKey);
expect(() => {
getAddressByIndex(fullViewingKey, 0);
}).not.toThrow();
});
});
describe('getEphemeralByIndex()', () => {
it('does not raise zod validation error', () => {
const spendKey = generateSpendKey(seedPhrase);
const fullViewingKey = getFullViewingKey(spendKey);
expect(() => {
getEphemeralByIndex(fullViewingKey, 0);
}).not.toThrow();
});
});
describe('getWalletId()', () => {
it('does not raise zod validation error', () => {
const spendKey = generateSpendKey(seedPhrase);
const fullViewingKey = getFullViewingKey(spendKey);
expect(() => {
getWalletId(fullViewingKey);
}).not.toThrow();
});
});
});