Skip to content

Commit

Permalink
test: address comments add forge and parse operation test suite back …
Browse files Browse the repository at this point in the history
…with lima cases

re #2065
  • Loading branch information
hui-an-yang committed Nov 23, 2022
1 parent 5a68628 commit d67480b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion integration-tests/data/allTestsCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ export const commonCases: TestCase[] = [

export const limaCases: TestCase[] = [
// In `opMapping` from the file `constants.ts`, the operations and types starting at `ticket` were added in the lima protocol
...extractOp(152, 154, opMapping).map((op): TestCase => {
...extractOp(154, 154, opMapping).map((op): TestCase => {
return {
name: `Origination operation (${op})`,
operation: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ticketCode3Proto14,
ticketStorage3Proto14,
} from '../../../integration-tests/data/code_with_ticket_proto14';
import { commonCases } from '../../../integration-tests/data/allTestsCases';
import { commonCases, limaCases } from '../../../integration-tests/data/allTestsCases';
import {
InvalidOperationSchemaError,
InvalidBlockHashError,
Expand All @@ -31,6 +31,17 @@ describe('Forge and parse operations default protocol', () => {
});
});

describe('Forge and parse operations lima protocol', () => {
const localForger = new LocalForger();
limaCases.forEach(({ name, operation, expected }) => {
test(`Common test: ${name}`, async (done) => {
const result = await localForger.forge(operation);
expect(await localForger.parse(result)).toEqual(expected || operation);
done();
});
});
});

describe('Forge should validate parameters against the schema', () => {
const hexToParse = `0572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e166a9d8cabc673a322fda673779d8e3822ba3ecb8670e461f73bb9021d5fd76a4c56d9d4cd16bd1bba86881979749d28`;

Expand Down

0 comments on commit d67480b

Please sign in to comment.