Skip to content

Commit

Permalink
refactor(t/vc): refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
aleeusgr committed Jun 14, 2023
1 parent 5331ab1 commit a2e901f
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions tests/vesting-cancel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ describe("a vesting contract: Cancel transaction", async () => {
context.network = network;
})

it ("docs the tx ingridients", async ({network, alice, validatorHash}) => {
// network.getUtxos(alice.address)
it ("documents the initial network state", async ({network, alice, validatorHash}) => {
// EmulatorWallet
const aliceUtxos = await alice.utxos;
// https://www.hyperion-bt.org/helios-book/api/reference/address.html?highlight=Address#address
Expand All @@ -64,7 +63,32 @@ describe("a vesting contract: Cancel transaction", async () => {

})

it ("locks funds and tries to unlock as the owner", async ({network, alice, bob, program}) => {
it ("tests cancelVesting.ts", async ({network, alice, bob, program}) => {
const optimize = false; // need to add it to the context
const compiledScript = program.compile(optimize);
const validatorHash = compiledScript.validatorHash;
const validatorAddress = Address.fromValidatorHash(validatorHash);

expect((await alice.utxos)[0].value.dump().lovelace).toBe('20000000');
expect((await alice.utxos)[1].value.dump().lovelace).toBe('50000000');

const adaQty = 10;
const duration = 1000000;
await lockAda(network!, alice!, bob!, program, adaQty, duration);
expect((await alice.utxos)[0].value.dump().lovelace).toBe('50000000');
expect((await alice.utxos)[1].value.dump().lovelace).toBe('9755287');

await cancelVesting(network!, alice!, program );

const oracle = await alice.utxos;

// think about which is which.
expect(oracle[2].value.dump().lovelace).toBe('9546007');
expect(oracle[1].value.dump().lovelace).toBe('10000000');//
expect(oracle[0].value.dump().lovelace).toBe('50000000');// collateral?
})

it ("documents cancelVesting", async ({network, alice, bob, program}) => {
// Obtain UPLC:
// need to add it to the context
// Compile the Helios script
Expand Down Expand Up @@ -131,30 +155,6 @@ describe("a vesting contract: Cancel transaction", async () => {

const oracle = await alice.utxos;

// think about which is which.
expect(oracle[2].value.dump().lovelace).toBe('9546007');
expect(oracle[1].value.dump().lovelace).toBe('10000000');//
expect(oracle[0].value.dump().lovelace).toBe('50000000');// collateral?
})
it ("tests cancelVesting.ts", async ({network, alice, bob, program}) => {
const optimize = false; // need to add it to the context
const compiledScript = program.compile(optimize);
const validatorHash = compiledScript.validatorHash;
const validatorAddress = Address.fromValidatorHash(validatorHash);

expect((await alice.utxos)[0].value.dump().lovelace).toBe('20000000');
expect((await alice.utxos)[1].value.dump().lovelace).toBe('50000000');

const adaQty = 10;
const duration = 1000000;
await lockAda(network!, alice!, bob!, program, adaQty, duration);
expect((await alice.utxos)[0].value.dump().lovelace).toBe('50000000');
expect((await alice.utxos)[1].value.dump().lovelace).toBe('9755287');

await cancelVesting(network!, alice!, program );

const oracle = await alice.utxos;

// think about which is which.
expect(oracle[2].value.dump().lovelace).toBe('9546007');
expect(oracle[1].value.dump().lovelace).toBe('10000000');//
Expand Down

0 comments on commit a2e901f

Please sign in to comment.