-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* upgraded versions + changed to interpreter * finished refactoring file structure and improved examples * improved example package.json * reverted motoko upgrade * checking version * attempting to fix dfx version for CI * temporary fix of dfx 14 * improed ci with dfx install * fixing with dfx start --------- Co-authored-by: Tiago Loureiro <[email protected]>
- Loading branch information
Showing
18 changed files
with
1,388 additions
and
7,918 deletions.
There are no files selected for viewing
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
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,41 +1,18 @@ | ||
{ | ||
"name": "motoko_unit_tests_assets", | ||
"name": "mospec_example", | ||
"version": "0.1.0", | ||
"description": "Internet Computer starter application", | ||
"description": "MoSpec Example", | ||
"keywords": [ | ||
"Internet Computer", | ||
"Motoko", | ||
"JavaScript", | ||
"Canister" | ||
"Canister", | ||
"Test", | ||
"MoSpec" | ||
], | ||
"scripts": { | ||
"build": "webpack", | ||
"prebuild": "npm run copy:types", | ||
"start": "webpack serve --mode development --env development", | ||
"prestart": "npm run copy:types", | ||
"copy:types": "rsync -avr .dfx/$(echo ${DFX_NETWORK:-'**'})/canisters/** --exclude='assets/' --exclude='idl/' --exclude='*.wasm' --delete src/declarations" | ||
"test": "mo-test --testmode interpreter --verbose" | ||
}, | ||
"devDependencies": { | ||
"@dfinity/agent": "0.10.2", | ||
"@dfinity/candid": "0.10.2", | ||
"@dfinity/principal": "0.10.2", | ||
"assert": "2.0.0", | ||
"buffer": "6.0.3", | ||
"copy-webpack-plugin": "^9.0.1", | ||
"events": "3.3.0", | ||
"html-webpack-plugin": "5.5.0", | ||
"process": "0.11.10", | ||
"stream-browserify": "3.0.0", | ||
"terser-webpack-plugin": "5.2.5", | ||
"util": "0.12.4", | ||
"webpack": "5.63.0", | ||
"webpack-cli": "4.9.1", | ||
"webpack-dev-server": "^4.4.0" | ||
}, | ||
"browserslist": [ | ||
"last 2 chrome version", | ||
"last 2 firefox version", | ||
"last 2 safari version", | ||
"last 2 edge version" | ||
] | ||
"mo-dev": "^0.7.1" | ||
} | ||
} |
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,68 @@ | ||
import U "Utils"; | ||
import Debug "mo:base/Debug"; | ||
import MoSpec "../../../src/MoSpec"; | ||
|
||
let assertTrue = MoSpec.assertTrue; | ||
let describe = MoSpec.describe; | ||
let context = MoSpec.context; | ||
let before = MoSpec.before; | ||
let it = MoSpec.it; | ||
let skip = MoSpec.skip; | ||
let pending = MoSpec.pending; | ||
let run = MoSpec.run; | ||
|
||
// setup | ||
var iterator = 0; | ||
|
||
let success = run([ | ||
describe( | ||
"#sum", | ||
[ | ||
before( | ||
do { | ||
iterator += 1; | ||
} | ||
), | ||
context( | ||
"when something happens", | ||
[ | ||
it( | ||
"should assess a boolean value", | ||
do { | ||
assertTrue(true); | ||
}, | ||
), | ||
it( | ||
"should sum two positive Nats", | ||
do { | ||
assertTrue(U.sum((1, 2)) == 3); | ||
}, | ||
), | ||
it( | ||
"should check that doesn't match", | ||
do { | ||
assertTrue(U.sum((1, 2)) != 4); | ||
}, | ||
), | ||
it( | ||
"before do should have run 1 times", | ||
do { | ||
assertTrue(iterator == 1); | ||
}, | ||
), | ||
skip( | ||
"should skip a test", | ||
do { | ||
// Useful for defining a test that is not yet implemented | ||
true; | ||
}, | ||
), | ||
], | ||
), | ||
], | ||
), | ||
]); | ||
|
||
if (success == false) { | ||
Debug.trap("Tests failed"); | ||
}; |
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.