From 0eee6499564032ba2fc7871949dca648bb0f062d Mon Sep 17 00:00:00 2001 From: Davis Sawali Date: Fri, 1 Dec 2023 15:59:16 -0800 Subject: [PATCH] added op confirmation --- .../contract-pair-as-key.spec.ts | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/integration-tests/contract-pair-as-key.spec.ts b/integration-tests/contract-pair-as-key.spec.ts index 8f4f9bcc28..8a8ede5459 100644 --- a/integration-tests/contract-pair-as-key.spec.ts +++ b/integration-tests/contract-pair-as-key.spec.ts @@ -7,12 +7,11 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { const Tezos = lib; describe(`Test contract origination with pair as key in storage through contract api using: ${rpc}`, () => { - beforeEach(async () => { - await setup() - }) + await setup(); + }); - test('Verify contract.originate for a contract with pair as a key', async () => { + it('Verify contract.originate for a contract with pair as a key', async () => { const storageMap = new MichelsonMap(); // The contract schema in this example has a key with 8 nested pairs // (int(nat(string(bytes(mutez(bool(key_hash(timestamp(address))))))))) @@ -63,28 +62,35 @@ CONFIGS().forEach(({ lib, rpc, setup }) => { 6: "tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5", 7: "2018-09-06T15:08:29.000Z", 8: "tz3WXYtyDUNL91qfiCJtVUX746QpNv5i5ve5" - }, 100) + }, 100); + const op = await Tezos.contract.originate({ balance: "0", code: storageContractWithPairAsKey, storage: storageMap - }) + }); + await op.confirmation(); + await op.contract() + expect(op.hash).toBeDefined(); - expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY) + expect(op.includedInBlock).toBeLessThan(Number.POSITIVE_INFINITY); }) - test('Verify contract.originate for a contract with pair as a key in map ', async () => { + it('Verify contract.originate for a contract with pair as a key in map ', async () => { /** The init property is used in this test instead of the storage property as in the previous test. */ const op = await Tezos.contract.originate({ balance: "0", code: mapWithPairAsKeyCode, init: mapWithPairAsKeyStorage - }) + }); + await op.confirmation(); + const contract = await op.contract() + const storage2: BigMapAbstraction = await contract.storage(); - const value = await storage2.get({ 'test': 'test2', 'test2': 'test3' }) - expect(value).toEqual('test') + const value = await storage2.get({ 'test': 'test2', 'test2': 'test3' }); + expect(value).toEqual('test'); }); }); -}) +});