Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ rec {

dfx = import ./dfx.nix { inherit pkgs userlib-js; };

e2e-tests = import ./e2e { inherit pkgs dfx; };
e2e-tests = import ./e2e/bats { inherit pkgs dfx; };
node-e2e-tests = import ./e2e/node { inherit pkgs dfx; };

userlib-js = import ./src/userlib/js { inherit pkgs; };

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions e2e/default.nix → e2e/bats/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ pkgs ? import ../nix { inherit system; }
{ pkgs ? import ../../nix { inherit system; }
, system ? builtins.currentSystem
, dfx ? import ../dfx.nix { inherit pkgs; }
, dfx ? import ../../dfx.nix { inherit pkgs; }
}:
let
e2e = lib.noNixFiles (lib.gitOnlySource ../. "e2e");
e2e = lib.noNixFiles (lib.gitOnlySource ../../. ./.);
lib = pkgs.lib;
sources = pkgs.sources;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions e2e/node/basic/call.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import counterFactory from '../utils/canisters/counter';

test('can call a canister', async () => {
let counter = await counterFactory();

expect(+(await counter.read())).toEqual(0);
expect(+(await counter.inc_read())).toEqual(1);
await counter.write(10);
expect(+(await counter.read())).toEqual(10);
expect(+(await counter.inc_read())).toEqual(11);
});
45 changes: 45 additions & 0 deletions e2e/node/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{ pkgs ? import ../../nix { inherit system; }
, system ? builtins.currentSystem
, dfx ? import ../../dfx.nix { inherit pkgs; }
, userlib-js ? import ../../src/userlib/js { inherit pkgs; }
}:
let
e2e = pkgs.lib.noNixFiles (lib.gitOnlySource ../../. ./.);
in

pkgs.napalm.buildPackage e2e {
root = ./.;
name = "node-e2e-tests";
buildInputs = inputs;
PATH = pkgs.lib.makeSearchPath "bin" [
coreutils
dfx.standalone
nodejs-12_x
];

npmCommands = [
"npm install"

# Monkey-patch the userlib source into our install dir. napalm is unable
# to include dependencies from package-locks in places other than the
# build root.
(
pkgs.writeScript "include-userlib.sh" ''
#!${pkgs.stdenv.shell}
set -eo pipefail

userlib="node_modules/@internet-computer/userlib"
mkdir -p $userlib

tar xvzf ${userlib-js.out}/internet-computer-*.tgz --strip-component 1 --directory $userlib/
cp -R ${userlib-js.lib}/node_modules .
''
)
"npm run ci"
];

installPhase = ''
echo Done.
touch $out
'';
}
23 changes: 23 additions & 0 deletions e2e/node/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
bail: false,
testTimeout: 60000,
globalSetup: './setup',
globalTeardown: './teardown',
setupFiles: [
"./test-setup",
],
setupFilesAfterEnv: [
"jest-expect-message",
],
// Since we're running e2e tests, ALL typescript files are up for grab.
testMatch: [
"**/*.ts"
],
testPathIgnorePatterns: [
"/node_modules/",
"/utils/",
],
transform: {
"^.+\\.ts$": "ts-jest"
}
};
Loading