Skip to content

Commit

Permalink
fix: address comments removed duplicate tests and move kathcases to c…
Browse files Browse the repository at this point in the history
…ommoncases

re #2065
  • Loading branch information
hui-an-yang committed Nov 19, 2022
1 parent f3761d5 commit db7ece5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 63 deletions.
24 changes: 1 addition & 23 deletions integration-tests/contract-edo-deploy-having-ticket.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
await setup();
done()
})
kathmandunet('Originates a contract having ticket with init and the wallet api', async (done) => {
const op = await Tezos.wallet.originate({
code: ticketCodeProto14,
init: ticketStorageProto14
}).send();

await op.confirmation();
expect(op.opHash).toBeDefined();

done();
});

kathmandunet('Originates a contract having ticket with init and the contract api', async (done) => {
const op = await Tezos.contract.originate({
Expand Down Expand Up @@ -75,18 +64,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
await setup();
done()
})
limanetAndAlpha('Originates a contract having ticket with init and the wallet api', async (done) => {
const op = await Tezos.wallet.originate({
code: ticketCode,
init: ticketStorage
}).send();

await op.confirmation();
expect(op.opHash).toBeDefined();

done();
});


limanetAndAlpha('Originates a contract having ticket with init and the contract api', async (done) => {
const op = await Tezos.contract.originate({
code: ticketCode,
Expand Down
31 changes: 2 additions & 29 deletions integration-tests/data/allTestsCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ export const commonCases: TestCase[] = [
],
},
},
...extractOp(0, 150, opMappingProto14).map((op): TestCase => {
...extractOp(0, 151, opMappingProto14).map((op): TestCase => {
return {
name: `Origination operation (${op})`,
operation: {
Expand Down Expand Up @@ -1344,32 +1344,6 @@ export const commonCases: TestCase[] = [
],
},
},
];

export const kathmanduCases: TestCase[] = [
...extractOp(150, 151, opMappingProto14).map((op): TestCase => {
return {
name: `Origination operation (${op})`,
operation: {
branch: 'BLzyjjHKEKMULtvkpSHxuZxx6ei6fpntH2BTkYZiLgs8zLVstvX',
contents: [
{
kind: OpKind.ORIGINATION,
counter: '1',
source: 'tz1QZ6KY7d3BuZDT1d19dUxoQrtFPN2QJ3hn',
fee: '10000',
gas_limit: '10',
storage_limit: '10',
balance: '0',
script: {
code: genericCode(op) as MichelsonV1Expression[],
storage: genericStorage,
},
},
],
},
};
}),
{
name: `Origination of a contract that contains the instructions EMIT`,
operation: {
Expand Down Expand Up @@ -1413,10 +1387,9 @@ export const kathmanduCases: 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(154, 154, opMapping).map((op): TestCase => {
...extractOp(152, 154, opMapping).map((op): TestCase => {
return {
name: `Origination operation (${op})`,
operation: {
Expand Down
22 changes: 11 additions & 11 deletions packages/taquito-local-forging/test/taquito-local-forging.spec.ts
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, kathmanduCases } from '../../../integration-tests/data/allTestsCases';
import { commonCases } from '../../../integration-tests/data/allTestsCases';
import {
InvalidOperationSchemaError,
InvalidBlockHashError,
Expand All @@ -31,16 +31,16 @@ describe('Forge and parse operations default protocol', () => {
});
});

describe('Forge and parse operations kathmandu protocol', () => {
const localForger = new LocalForger();
kathmanduCases.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 and parse operations kathmandu protocol', () => {
// const localForger = new LocalForger();
// kathmanduCases.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 db7ece5

Please sign in to comment.