Skip to content

Commit

Permalink
fix: add more test regarding mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Feb 9, 2024
1 parent 8cd97d9 commit 66de8e5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/sdk/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,34 @@ describe('token', () => {
expect(instance.hasKeypair).toBeDefined();
});

it('creates an instance for mock', async () => {
const instance = await createInstance({
chainId: 1234,
});
expect(instance.encrypt8).toBeDefined();
expect(instance.encrypt16).toBeDefined();
expect(instance.encrypt32).toBeDefined();
expect(instance.encrypt64).toBeDefined();
expect(instance.generatePublicKey).toBeDefined();
expect(instance.decrypt).toBeDefined();
expect(instance.serializeKeypairs).toBeDefined();
expect(instance.getPublicKey).toBeDefined();
expect(instance.hasKeypair).toBeDefined();

expect(() => instance.encrypt8(2)).toThrow(
'Your instance has been created without the public blockchain key',
);
expect(() => instance.encrypt16(2)).toThrow(
'Your instance has been created without the public blockchain key',
);
expect(() => instance.encrypt32(2)).toThrow(
'Your instance has been created without the public blockchain key',
);
expect(() => instance.encrypt64(2)).toThrow(
'Your instance has been created without the public blockchain key',
);
});

it('fails to create an instance', async () => {
await expect(
createInstance({
Expand Down

0 comments on commit 66de8e5

Please sign in to comment.