Skip to content

Commit

Permalink
added op confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
dsawali committed Dec 1, 2023
1 parent 3ea8250 commit 0eee649
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions integration-tests/contract-pair-as-key.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)))))))))
Expand Down Expand Up @@ -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');
});
});
})
});

0 comments on commit 0eee649

Please sign in to comment.