Skip to content

Commit

Permalink
change beforeEach to beforeAll
Browse files Browse the repository at this point in the history
  • Loading branch information
dsawali committed Nov 30, 2023
1 parent 3c5a86e commit 8afb525
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 64 deletions.
126 changes: 63 additions & 63 deletions integration-tests/contract-batch-register-global-constant.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,74 @@ import { OpKind } from '@taquito/taquito';
const crypto = require('crypto');

CONFIGS().forEach(({ lib, rpc, setup }) => {
const Tezos = lib;
describe(`Test contract.batch to register global constant using: ${rpc}`, () => {
const randomAnnots = () => crypto.randomBytes(3).toString('hex');
beforeEach(async () => {
await setup(true);
});
const Tezos = lib;
describe(`Test contract.batch to register global constant using: ${rpc}`, () => {
const randomAnnots = () => crypto.randomBytes(3).toString('hex');
beforeEach(async () => {
await setup(true);
});

test('Verify the contract.batch transfer and register global constant operations', async () => {
const isAccountRevealed = await Tezos.rpc.getManagerKey(await Tezos.signer.publicKeyHash());
test('Verify the contract.batch transfer and register global constant operations', async () => {
const isAccountRevealed = await Tezos.rpc.getManagerKey(await Tezos.signer.publicKeyHash());

const batchOp = await Tezos.contract
.batch([
{ kind: OpKind.TRANSACTION, to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 },
{
kind: OpKind.REGISTER_GLOBAL_CONSTANT,
value: {
prim: 'list',
args: [{ prim: 'nat' }],
annots: [`%${randomAnnots()}`]
}
}
])
.with([
{ kind: OpKind.TRANSACTION, to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 },
{
kind: OpKind.REGISTER_GLOBAL_CONSTANT,
value: {
prim: 'int',
args: [{ int: '123456' }],
annots: [`%${randomAnnots()}`]
}
}
])
.withRegisterGlobalConstant({
value: {
prim: 'pair',
args: [
{
prim: 'pair',
args: [{ prim: 'address', annots: ['%0'] }, { prim: 'address', annots: ['%1'] }]
},
{ prim: 'contract', args: [{ prim: 'nat' }], annots: ['%2'] }
],
annots: [`%${randomAnnots()}`]
}
})
.send();
const batchOp = await Tezos.contract
.batch([
{ kind: OpKind.TRANSACTION, to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 },
{
kind: OpKind.REGISTER_GLOBAL_CONSTANT,
value: {
prim: 'list',
args: [{ prim: 'nat' }],
annots: [`%${randomAnnots()}`]
}
}
])
.with([
{ kind: OpKind.TRANSACTION, to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.02 },
{
kind: OpKind.REGISTER_GLOBAL_CONSTANT,
value: {
prim: 'int',
args: [{ int: '123456' }],
annots: [`%${randomAnnots()}`]
}
}
])
.withRegisterGlobalConstant({
value: {
prim: 'pair',
args: [
{
prim: 'pair',
args: [{ prim: 'address', annots: ['%0'] }, { prim: 'address', annots: ['%1'] }]
},
{ prim: 'contract', args: [{ prim: 'nat' }], annots: ['%2'] }
],
annots: [`%${randomAnnots()}`]
}
})
.send();

await batchOp.confirmation();
await batchOp.confirmation();

expect(batchOp.status).toEqual('applied');
expect(batchOp.status).toEqual('applied');

if (!isAccountRevealed) {
expect(batchOp.results.length).toEqual(6);
expect(batchOp.results[0].kind).toEqual(OpKind.REVEAL);
expect(batchOp.results[1].kind).toEqual(OpKind.TRANSACTION);
expect(batchOp.results[2].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
expect(batchOp.results[3].kind).toEqual(OpKind.TRANSACTION);
expect(batchOp.results[4].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
expect(batchOp.results[5].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
} else {
expect(batchOp.results[0].kind).toEqual(OpKind.TRANSACTION);
expect(batchOp.results[1].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
expect(batchOp.results[2].kind).toEqual(OpKind.TRANSACTION);
expect(batchOp.results[3].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
expect(batchOp.results[4].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
}
if (!isAccountRevealed) {
expect(batchOp.results.length).toEqual(6);
expect(batchOp.results[0].kind).toEqual(OpKind.REVEAL);
expect(batchOp.results[1].kind).toEqual(OpKind.TRANSACTION);
expect(batchOp.results[2].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
expect(batchOp.results[3].kind).toEqual(OpKind.TRANSACTION);
expect(batchOp.results[4].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
expect(batchOp.results[5].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
} else {
expect(batchOp.results[0].kind).toEqual(OpKind.TRANSACTION);
expect(batchOp.results[1].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
expect(batchOp.results[2].kind).toEqual(OpKind.TRANSACTION);
expect(batchOp.results[3].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
expect(batchOp.results[4].kind).toEqual(OpKind.REGISTER_GLOBAL_CONSTANT);
}

});
});
});
});
2 changes: 1 addition & 1 deletion integration-tests/wallet-manager-scenario.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CONFIGS().forEach(({ lib, rpc, setup, knownBaker, knownContract }) => {
let contract: DefaultWalletType;

describe(`Test TZ Manager through wallet api: ${rpc}`, () => {
beforeEach(async () => {
beforeAll(async () => {
await setup();

op = await Tezos.wallet.originate({
Expand Down

0 comments on commit 8afb525

Please sign in to comment.