-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from fospring/fix-issue-225/fix-deserializati…
…on-caused-by-near-sanbox fix-issue-225: fix deserialization error caused by near sanbox
- Loading branch information
Showing
46 changed files
with
144 additions
and
47 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
examples/simple-project/__tests__/test-simple-project.ava.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+358 KB
examples/simple-project/contracts/near_smart_contract_rust_template.wasm
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.