Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 5 additions & 35 deletions tooling/noir_js/test/node/execute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,20 @@ it('executes a single-ACIR program correctly', async () => {
expect(returnValue).to.be.eq('0x05');
});

it('circuit with a fmt string assert message should fail with the resolved assertion message', async () => {
it('successfully executes a program with multiple acir circuits', async () => {
const inputs = {
x: '10',
y: '5',
};
try {
await new Noir(assert_msg_runtime).execute(inputs);
} catch (error) {
const knownError = error as Error;
expect(knownError.message).to.equal('Circuit execution failed: Expected x < y but got 10 < 5');
}
});

it('circuit with a raw assert payload should fail with the decoded payload', async () => {
const inputs = {
x: '7',
y: '5',
};
try {
await new Noir(assert_raw_payload_json).execute(inputs);
} catch (error) {
const knownError = error as ErrorWithPayload;
const invalidXYErrorSelector = Object.keys(assert_raw_payload_json.abi.error_types)[0];
expect(knownError.rawAssertionPayload!.selector).to.equal(invalidXYErrorSelector);
expect(knownError.decodedAssertionPayload).to.deep.equal({
x: '0x07',
y: '0x05',
});
}
expect(() => new Noir(fold_fibonacci_program).execute(inputs)).to.not.throw();
});

it('successfully executes a program with multiple acir circuits', async () => {
it('circuit with a fmt string assert message should fail with the resolved assertion message', async () => {
const inputs = {
x: '10',
y: '5',
};
try {
await new Noir(fold_fibonacci_program).execute(inputs);
await new Noir(assert_msg_runtime).execute(inputs);
} catch (error) {
const knownError = error as Error;
expect(knownError.message).to.equal('Circuit execution failed: Expected x < y but got 10 < 5');
Expand All @@ -84,13 +61,6 @@ it('circuit with a raw assert payload should fail with the decoded payload', asy
}
});

it('successfully executes a program with multiple acir circuits', async () => {
const inputs = {
x: '10',
};
expect(() => new Noir(fold_fibonacci_program).execute(inputs)).to.not.throw();
});

it('successfully decodes the return values from a program using the databus', async () => {
const inputs = {
x: '3',
Expand Down