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
|
import * as esmDecodeCbor from './decodeCbor';
import { convertCOSEtoPKCS, COSEKEYS } from './convertCOSEtoPKCS';
test('should throw an error curve if, somehow, curve coordinate x is missing', () => {
const mockCOSEKey = new Map<number, number | Buffer>();
mockCOSEKey.set(COSEKEYS.y, 1);
jest.spyOn(esmDecodeCbor, 'decodeCborFirst').mockReturnValue(mockCOSEKey);
expect(() => {
convertCOSEtoPKCS(Buffer.from('123', 'ascii'));
}).toThrow();
});
test('should throw an error curve if, somehow, curve coordinate y is missing', () => {
const mockCOSEKey = new Map<number, number | Buffer>();
mockCOSEKey.set(COSEKEYS.x, 1);
jest.spyOn(esmDecodeCbor, 'decodeCborFirst').mockReturnValue(mockCOSEKey);
expect(() => {
convertCOSEtoPKCS(Buffer.from('123', 'ascii'));
}).toThrow();
});
|