Skip to content

Commit

Permalink
fix-issue-225: fix deserialization error caused by near sanbox
Browse files Browse the repository at this point in the history
  • Loading branch information
fospring committed Jan 15, 2024
1 parent 9f44ac3 commit 201d42e
Show file tree
Hide file tree
Showing 46 changed files with 144 additions and 47 deletions.
41 changes: 41 additions & 0 deletions examples/simple-project/__tests__/test-simple-project.ava.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* This test demonstrates basic behavior of near-workspaces, making simple
* function calls and view calls to the contract from
* https://github.com/near-examples/rust-status-message
*
* Note that the same tests will be run on both a local sandbox environment and
* on testnet by using the `test:sandbox` and `test:testnet` scripts in
* package.json.
*/
import {Worker, NEAR} from 'near-workspaces';
import test from 'ava';

test.beforeEach(async t => {
// Init the worker and start a Sandbox server
const worker = await Worker.init();

// Prepare sandbox for tests, create accounts, deploy contracts, etx.
const root = worker.rootAccount;
const contract = await root.devDeploy(
// source code: https://github.com/NEARFoundation/near-smart-contract-rust-template/tree/main
'contracts/near_smart_contract_rust_template.wasm',
{initialBalance: NEAR.parse('30 N').toJSON()},
);
const ali = await root.createSubAccount('ali', {initialBalance: NEAR.parse('3 N').toJSON()});

// Save state for test runs, it is unique for each test
t.context.worker = worker;
t.context.accounts = {root, contract, ali};
});

test.afterEach.always(async t => {
// Stop Sandbox server
await t.context.worker.tearDown().catch(error => {
console.log('Failed to tear down the worker:', error);
});
});

test('Root call new', async t => {
const {contract, ali} = t.context.accounts;
await ali.call(contract, 'new', {});
});
Binary file not shown.
6 changes: 5 additions & 1 deletion packages/js/dist/account/account-manager.js

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

2 changes: 1 addition & 1 deletion packages/js/dist/account/account-manager.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/js/dist/account/account.d.ts

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

2 changes: 1 addition & 1 deletion packages/js/dist/account/account.d.ts.map

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

6 changes: 5 additions & 1 deletion packages/js/dist/account/account.js

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

Loading

0 comments on commit 201d42e

Please sign in to comment.