-
Notifications
You must be signed in to change notification settings - Fork 11
/
structure-errors.test.js
33 lines (30 loc) · 1.07 KB
/
structure-errors.test.js
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
import InvalidControlInput from './errors/InvalidControlInput.js'
import { LogicEngine, AsyncLogicEngine } from './index.js'
const engines = [
new LogicEngine(),
new AsyncLogicEngine()
]
describe('Test throwing errors for dynamic control structures', () => {
engines.forEach((engine) => {
test('map (normal)', async () => {
expect(async () => {
await engine.run({ map: { preserve: [[1, 2, 3], { var: '' }] } })
}).rejects.toThrow(InvalidControlInput)
})
test('reduce (normal)', async () => {
expect(async () => {
await engine.run({ reduce: { preserve: [[1, 2, 3], { var: '' }] } })
}).rejects.toThrow(InvalidControlInput)
})
test('map (built)', async () => {
expect(async () => {
await engine.build({ map: { preserve: [[1, 2, 3], { var: '' }] } })
}).rejects.toThrow(InvalidControlInput)
})
test('reduce (built)', async () => {
expect(async () => {
await engine.build({ reduce: { preserve: [[1, 2, 3], { var: '' }] } })
}).rejects.toThrow(InvalidControlInput)
})
})
})