Skip to content

Commit

Permalink
test(helios-vesting-cancel-test): moved networkParam init to earlier …
Browse files Browse the repository at this point in the history
…point and added test for init slot and time
  • Loading branch information
aleeusgr committed May 26, 2023
1 parent b661223 commit f71149f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/helios-vesting-cancel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ describe("a vesting contract: Cancel transaction", async () => {
expect((await alice.utxos)[1].value.dump().lovelace).toBe('9753780');

// building Cancel tx
const networkParamsFile = await fs.readFile('./src/preprod.json', 'utf8');
const networkParams = new NetworkParams(JSON.parse(networkParamsFile.toString()));

const keyMPH = '49b106e698de78171de2faf35932635e1085c12508ca87718a2d4487'

const minAda : number = 2000000; // minimum lovelace needed to send an NFT
Expand Down Expand Up @@ -114,6 +117,7 @@ describe("a vesting contract: Cancel transaction", async () => {
// by 5 mins.
const emulatorDate = 1677108984000; // from src/preprod.json
const initSlot = BigInt(21425784); // fyi
expect(await networkParams.slotToTime(initSlot)).toBe(BigInt(emulatorDate));

const earlierTime = new Date(emulatorDate - 5 * 60 * 1000);
const laterTime = new Date(emulatorDate + 20 * 60 * 60 * 1000);
Expand All @@ -132,8 +136,6 @@ describe("a vesting contract: Cancel transaction", async () => {
expect(colatUtxo.value.dump().lovelace).toBe('50000000');
tx.addCollateral(colatUtxo);

const networkParamsFile = await fs.readFile('./src/preprod.json', 'utf8');
const networkParams = new NetworkParams(JSON.parse(networkParamsFile.toString()));

await tx.finalize(networkParams, ownerAddress, [spareUtxo]);

Expand Down

0 comments on commit f71149f

Please sign in to comment.