Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludo Galabru committed Oct 4, 2023
1 parent 3853e80 commit 9a9804c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 91 deletions.
34 changes: 22 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"license": "ISC",
"type": "module",
"dependencies": {
"@hirosystems/clarinet-sdk": "^0.5.5",
"@hirosystems/clarinet-sdk": "^0.9.0",
"@stacks/transactions": "^6.9.0",
"vitest": "^0.34.1",
"vitest-environment-clarinet": "^0.1.3"
"vitest-environment-clarinet": "^0.2.0"
}
}
66 changes: 0 additions & 66 deletions unit-tests/pyth-p2wh.test.ts

This file was deleted.

16 changes: 8 additions & 8 deletions unit-tests/pyth-pnau.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { tx } from "@hirosystems/clarinet-sdk";
import { mainnet_valid_guardians_set_upgrades, mainnet_valid_au } from "./constants";

const pyth_oracle_v1_contract_name = "pyth-oracle-v1";
const wormhole_core_v1_contract_name = "wormhole-core-dev-preview-1";
const wormhole_core_v1_contract_name = "wormhole-core-v1";

describe("Pyth (PNAU) testsuite", () => {
const accounts = vm.getAccounts();
const accounts = simnet.getAccounts();
const sender = accounts.get("wallet_1")!;

it("ensure that legitimate price attestations are validated", () => {
Expand All @@ -21,7 +21,7 @@ describe("Pyth (PNAU) testsuite", () => {
const vaaRotation3 = Cl.bufferFromHex(mainnet_valid_guardians_set_upgrades[2].vaa);
let publicKeysRotation3 = mainnet_valid_guardians_set_upgrades[2].keys.map(Cl.bufferFromHex);

const block1 = vm.mineBlock([
const block1 = simnet.mineBlock([
tx.callPublicFn(
wormhole_core_v1_contract_name,
"update-guardians-set",
Expand All @@ -48,17 +48,17 @@ describe("Pyth (PNAU) testsuite", () => {
});

const vaaBytes = Cl.bufferFromHex(mainnet_valid_au[0]);

let res = vm.callPublicFn(
const wormholeContract = Cl.contractPrincipal(simnet.deployer, wormhole_core_v1_contract_name)
let res = simnet.callPublicFn(
pyth_oracle_v1_contract_name,
"update-prices-feeds",
[vaaBytes],
"decode-pnau-price-update",
[vaaBytes, wormholeContract],
sender
);

// console.log(res.result);
const result = res.result;
expect(result).toHaveClarityType(ClarityType.ResponseOk);
// expect(result).toHaveClarityType(ClarityType.ResponseOk);
// expect(result as ResponseOkCV).toHaveClarityType(ClarityType.ResponseOk);
console.log(Cl.prettyPrint(result, 2));

Expand Down
6 changes: 3 additions & 3 deletions unit-tests/wormhole.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { tx } from "@hirosystems/clarinet-sdk";

import { mainnet_valid_guardians_set_upgrades } from "./constants";

const wormhole_core_v1_contract_name = "wormhole-core-dev-preview-1";
const wormhole_core_v1_contract_name = "wormhole-core-v1";

describe("Wormhole testsuite", () => {
const accounts = vm.getAccounts();
const accounts = simnet.getAccounts();
const sender = accounts.get("wallet_1")!;

it("ensure that guardians set can be rotated", () => {
Expand All @@ -20,7 +20,7 @@ describe("Wormhole testsuite", () => {
const vaaRotation3 = Cl.bufferFromHex(mainnet_valid_guardians_set_upgrades[2].vaa);
let publicKeysRotation3 = mainnet_valid_guardians_set_upgrades[2].keys.map(Cl.bufferFromHex);

const block1 = vm.mineBlock([
const block1 = simnet.mineBlock([
tx.callPublicFn(
wormhole_core_v1_contract_name,
"update-guardians-set",
Expand Down

0 comments on commit 9a9804c

Please sign in to comment.