From d67480bf19e9d10bc6718bd3f7ef3d6c9c5f3431 Mon Sep 17 00:00:00 2001 From: huianyang Date: Wed, 23 Nov 2022 13:10:24 -0800 Subject: [PATCH] test: address comments add forge and parse operation test suite back with lima cases re #2065 --- integration-tests/data/allTestsCases.ts | 2 +- .../test/taquito-local-forging.spec.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/integration-tests/data/allTestsCases.ts b/integration-tests/data/allTestsCases.ts index a5ba048a1e..f343f0d75f 100644 --- a/integration-tests/data/allTestsCases.ts +++ b/integration-tests/data/allTestsCases.ts @@ -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: { diff --git a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts index 2ef05d9d51..1d20457a29 100644 --- a/packages/taquito-local-forging/test/taquito-local-forging.spec.ts +++ b/packages/taquito-local-forging/test/taquito-local-forging.spec.ts @@ -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, @@ -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`;