-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathmemory-pool-handle.test.ts
40 lines (39 loc) · 1.54 KB
/
memory-pool-handle.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
import { SEALLibrary } from '../implementation/seal'
import SEAL from '../throws_wasm_node_umd'
let seal: SEALLibrary
beforeAll(async () => {
seal = await SEAL()
})
describe('MemoryPoolHandle', () => {
test('It should be a static instance', () => {
expect(seal.MemoryPoolHandle).toBeDefined()
expect(typeof seal.MemoryPoolHandle.constructor).toBe('function')
expect(seal.MemoryPoolHandle).toBeInstanceOf(Object)
expect(seal.MemoryPoolHandle.constructor).toBe(Object)
expect(seal.MemoryPoolHandle.constructor.name).toBe('Object')
})
test('It should have properties', () => {
expect(seal.MemoryPoolHandle).toHaveProperty('global')
expect(seal.MemoryPoolHandle).toHaveProperty('threadLocal')
})
test('It should return a pointer to the global handle', () => {
const pool = seal.MemoryPoolHandle.global
expect(pool).toBeDefined()
expect(typeof pool.constructor).toBe('function')
expect(pool).toBeInstanceOf(Object)
expect(pool.constructor).toBe(seal.MemoryPoolHandle.global.constructor)
expect(seal.MemoryPoolHandle.global.constructor.name).toBe(
'MemoryPoolHandle'
)
})
test('It should return a pointer to a threadLocal handle', () => {
const pool = seal.MemoryPoolHandle.threadLocal
expect(pool).toBeDefined()
expect(typeof pool.constructor).toBe('function')
expect(pool).toBeInstanceOf(Object)
expect(pool.constructor).toBe(seal.MemoryPoolHandle.threadLocal.constructor)
expect(seal.MemoryPoolHandle.threadLocal.constructor.name).toBe(
'MemoryPoolHandle'
)
})
})