Skip to content

Commit

Permalink
simplify sandbox-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
gagdiez committed May 22, 2024
1 parent 3c656ab commit 1647fbc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 32 deletions.
15 changes: 0 additions & 15 deletions contract-ts/ava.config.cjs

This file was deleted.

14 changes: 6 additions & 8 deletions contract-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
"test": "$npm_execpath build && ava -- ./build/counter.wasm"
},
"dependencies": {
"near-cli": "^4.0.8",
"near-sdk-js": "1.0.0"
},
"devDependencies": {
"@ava/typescript": "^4.1.0",
"ava": "^6.1.2",
"ava": "^6.1.3",
"near-workspaces": "^3.5.0",
"ts-morph": "^21.0.1",
"ts-node": "^10.9.2",
"tsimp": "^2.0.11",
"typescript": "^5.3.3"
"typescript": "^5.4.5"
},
"ava": {
"files": ["sandbox-test/*.ava.js"]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Worker, NEAR, NearAccount } from "near-workspaces";
import anyTest, { TestFn } from "ava";
import anyTest from 'ava';
import { Worker, NEAR } from 'near-workspaces';
import { setDefaultResultOrder } from 'dns'; setDefaultResultOrder('ipv4first'); // temp fix for node >v17

const test = anyTest as TestFn<{
worker: Worker;
accounts: Record<string, NearAccount>;
}>;
/**
* @typedef {import('near-workspaces').NearAccount} NearAccount
* @type {import('ava').TestFn<{worker: Worker, accounts: Record<string, NearAccount>}>}
*/
const test = anyTest;

test.beforeEach(async (t) => {
// Init the worker and start a Sandbox server
Expand Down Expand Up @@ -36,7 +37,7 @@ test.afterEach.always(async (t) => {

test("can be incremented", async (t) => {
const { alice, contract } = t.context.accounts;
const startCounter: number = await contract.view("get_num", {});
const startCounter = await contract.view("get_num", {});
await alice.call(contract, "increment", {});
const endCounter = await contract.view("get_num", {});
t.is(endCounter, startCounter + 1);
Expand All @@ -45,7 +46,7 @@ test("can be incremented", async (t) => {
test("can be decremented", async (t) => {
const { alice, contract } = t.context.accounts;
await alice.call(contract, "increment", {});
const startCounter: number = await contract.view("get_num", {});
const startCounter = await contract.view("get_num", {});
await alice.call(contract, "decrement", {});
const endCounter = await contract.view("get_num", {});
t.is(endCounter, startCounter - 1);
Expand Down
1 change: 0 additions & 1 deletion contract-ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"noImplicitAny": false,
},
"files": [
"sandbox-ts/main.ava.ts",
"src/contract.ts"
],
"exclude": [
Expand Down

0 comments on commit 1647fbc

Please sign in to comment.