-
Notifications
You must be signed in to change notification settings - Fork 252
/
Copy patherrors.test.ts
26 lines (19 loc) · 1012 Bytes
/
errors.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
import { expect } from '@esm-bundle/chai';
import initNoirAbi, { abiEncode } from '@noir-lang/noirc_abi';
beforeEach(async () => {
await initNoirAbi();
});
it('errors when an integer input overflows', async () => {
const { abi, inputs } = await import('../shared/uint_overflow');
expect(() => abiEncode(abi, inputs)).to.throw(
'The value passed for parameter `foo` does not match the specified type:\nValue Field(2³⁸) does not fall within range of allowable values for a Integer { sign: Unsigned, width: 32 }',
);
});
it('errors when passing a field in place of an array', async () => {
const { abi, inputs } = await import('../shared/field_as_array');
expect(() => abiEncode(abi, inputs)).to.throw('cannot parse value into Array { length: 2, typ: Field }');
});
it('errors when passing an array in place of a field', async () => {
const { abi, inputs } = await import('../shared/array_as_field');
expect(() => abiEncode(abi, inputs)).to.throw('cannot parse value into Field');
});