-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathsecurity-level.test.ts
54 lines (53 loc) · 2.43 KB
/
security-level.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
import { SEALLibrary } from '../implementation/seal'
import SEAL from '../throws_wasm_node_umd'
let seal: SEALLibrary
beforeAll(async () => {
seal = await SEAL()
})
describe('SecurityLevel', () => {
test('It should be a static instance', () => {
expect(seal.SecurityLevel).toBeDefined()
expect(typeof seal.SecurityLevel.constructor).toBe('function')
expect(seal.SecurityLevel).toBeInstanceOf(Object)
expect(seal.SecurityLevel.constructor).toBe(Object)
expect(seal.SecurityLevel.constructor.name).toBe('Object')
})
test('It should have properties', () => {
expect(seal.SecurityLevel).toHaveProperty('none')
expect(seal.SecurityLevel).toHaveProperty('tc128')
expect(seal.SecurityLevel).toHaveProperty('tc192')
expect(seal.SecurityLevel).toHaveProperty('tc256')
})
test('It should return type none', async () => {
const securityLevel = seal.SecurityLevel.none
expect(securityLevel).toBeDefined()
expect(typeof securityLevel.constructor).toBe('function')
expect(securityLevel).toBeInstanceOf(Object)
expect(securityLevel.constructor).toBe(seal.SecurityLevel.none.constructor)
expect(seal.SecurityLevel.none.constructor.name).toBe('SecLevelType_none')
})
test('It should return type tc128', async () => {
const securityLevel = seal.SecurityLevel.tc128
expect(securityLevel).toBeDefined()
expect(typeof securityLevel.constructor).toBe('function')
expect(securityLevel).toBeInstanceOf(Object)
expect(securityLevel.constructor).toBe(seal.SecurityLevel.tc128.constructor)
expect(seal.SecurityLevel.tc128.constructor.name).toBe('SecLevelType_tc128')
})
test('It should return type tc192', async () => {
const securityLevel = seal.SecurityLevel.tc192
expect(securityLevel).toBeDefined()
expect(typeof securityLevel.constructor).toBe('function')
expect(securityLevel).toBeInstanceOf(Object)
expect(securityLevel.constructor).toBe(seal.SecurityLevel.tc192.constructor)
expect(seal.SecurityLevel.tc192.constructor.name).toBe('SecLevelType_tc192')
})
test('It should return type tc256', async () => {
const securityLevel = seal.SecurityLevel.tc256
expect(securityLevel).toBeDefined()
expect(typeof securityLevel.constructor).toBe('function')
expect(securityLevel).toBeInstanceOf(Object)
expect(securityLevel.constructor).toBe(seal.SecurityLevel.tc256.constructor)
expect(seal.SecurityLevel.tc256.constructor.name).toBe('SecLevelType_tc256')
})
})