Skip to content

Commit

Permalink
Merge pull request #365 from fospring/fix-issue-364/fix-run-test-fale…
Browse files Browse the repository at this point in the history
…d-somtimes

fix-issue-364: fix turbo run test faled somtimes
  • Loading branch information
ailisp authored Sep 5, 2023
2 parents 00674ee + ebffc67 commit ff58043
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test("migration works", async (t) => {
"hello"
);

contract.deploy("./build/status-message-migrate-add-field.wasm");
await contract.deploy("./build/status-message-migrate-add-field.wasm");
await ali.call(contract, "migrateState", {});

t.is(
Expand Down
2 changes: 1 addition & 1 deletion examples/__tests__/test-state-migration.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test("migration works", async (t) => {
const res1 = await contract.view("countMessages", {});
t.is(res1, 4);

contract.deploy("./build/state-migration-new.wasm");
await contract.deploy("./build/state-migration-new.wasm");

await ali.call(contract, "migrateState", {});

Expand Down
4 changes: 3 additions & 1 deletion tests/__tests__/bytes.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ test.beforeEach(async (t) => {
const root = worker.rootAccount;

// Deploy the test contract.
const bytesContract = await root.devDeploy("build/bytes.wasm");
const bytesContract = await root.createSubAccount("bytes-contract");
await bytesContract.deploy("build/bytes.wasm");

// Test users
const ali = await root.createSubAccount("ali");
const bob = await root.createSubAccount("bob");
Expand Down
6 changes: 2 additions & 4 deletions tests/__tests__/function-params.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ test.before(async (t) => {
// Prepare sandbox for tests, create accounts, deploy contracts, etx.
const root = worker.rootAccount;

// Deploy the test contract.
const functionParamsContract = await root.devDeploy(
"build/function-params.wasm"
);
const functionParamsContract = await root.createSubAccount("function-params-contract");
await functionParamsContract.deploy("build/function-params.wasm");

// Test users
const ali = await root.createSubAccount("ali");
Expand Down
3 changes: 2 additions & 1 deletion tests/__tests__/lookup-map.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test.beforeEach(async (t) => {
const root = worker.rootAccount;

// Deploy the test contract.
const lookupMapContract = await root.devDeploy("build/lookup-map.wasm");
const lookupMapContract = await root.createSubAccount("lookup-map-contract");
await lookupMapContract.deploy("build/lookup-map.wasm");

// Test users
const ali = await root.createSubAccount("ali");
Expand Down
3 changes: 2 additions & 1 deletion tests/__tests__/lookup-set.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test.beforeEach(async (t) => {
const root = worker.rootAccount;

// Deploy the test contract.
const lookupSetContract = await root.devDeploy("build/lookup-set.wasm");
const lookupSetContract = await root.createSubAccount("lookup-set-contract");
await lookupSetContract.deploy("build/lookup-set.wasm");
// Test users
const ali = await root.createSubAccount("ali");
const bob = await root.createSubAccount("bob");
Expand Down
3 changes: 2 additions & 1 deletion tests/__tests__/test-date-serialization.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test.beforeEach(async (t) => {
const root = worker.rootAccount;

// Create and deploy test contract
const dsContract = await root.devDeploy("build/date-serialization.wasm");
const dsContract = await root.createSubAccount("ds-contract");
await dsContract.deploy("build/date-serialization.wasm");

// Save state for test runs
t.context.worker = worker;
Expand Down
3 changes: 2 additions & 1 deletion tests/__tests__/test-middlewares.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test.beforeEach(async (t) => {
const root = worker.rootAccount;

// Deploy the contract.
const middlewares = await root.devDeploy("build/middlewares.wasm");
const middlewares = await root.createSubAccount("middlewares-contract");
await middlewares.deploy("build/middlewares.wasm");

// Create the init args.
const args = JSON.stringify({ randomData: "anything" });
Expand Down
3 changes: 2 additions & 1 deletion tests/__tests__/unordered-map.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test.beforeEach(async (t) => {
const root = worker.rootAccount;

// Deploy the test contract.
const unorderedMapContract = await root.devDeploy("build/unordered-map.wasm");
const unorderedMapContract = await root.createSubAccount("unordered-map-contract");
await unorderedMapContract.deploy("build/unordered-map.wasm");
// Test users
const ali = await root.createSubAccount("ali");
const bob = await root.createSubAccount("bob");
Expand Down
3 changes: 2 additions & 1 deletion tests/__tests__/unordered-set.ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ test.beforeEach(async (t) => {
const root = worker.rootAccount;

// Deploy the test contract.
const unorderedSetContract = await root.devDeploy("build/unordered-set.wasm");
const unorderedSetContract = await root.createSubAccount("unordered-set-contract");
await unorderedSetContract.deploy("build/unordered-set.wasm");

// Test users
const ali = await root.createSubAccount("ali");
Expand Down

0 comments on commit ff58043

Please sign in to comment.