Skip to content

Commit

Permalink
Merge pull request #1865 from demergent-labs/jest_final_first_part
Browse files Browse the repository at this point in the history
Jest final first part
  • Loading branch information
lastmjs authored Jul 9, 2024
2 parents f55805c + 0a13541 commit 9752896
Show file tree
Hide file tree
Showing 242 changed files with 37,347 additions and 9,781 deletions.
2 changes: 1 addition & 1 deletion examples/apollo_server/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { getTests } from './tests';

Expand Down
2 changes: 1 addition & 1 deletion examples/apollo_server/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

export function getTests(canisterId: string): Test {
const origin = `http://${canisterId}.localhost:8000`;
Expand Down
2 changes: 1 addition & 1 deletion examples/async_await/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from './dfx_generated/async_await';
import { getTests } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/async_await/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActorSubclass } from '@dfinity/agent';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

// @ts-ignore this path may not exist when these tests are imported into other test projects
import { _SERVICE } from './dfx_generated/async_await/async_await.did';
Expand Down
2 changes: 1 addition & 1 deletion examples/audio_and_video/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { getTests } from './tests';

Expand Down
2 changes: 1 addition & 1 deletion examples/audio_and_video/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';
import { createHash } from 'crypto';
import { readFileSync } from 'fs';

Expand Down
2 changes: 1 addition & 1 deletion examples/audio_recorder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"jest": "^29.7.0",
"ts-jest": "^29.1.4",
"ts-node": "10.7.0",
"typescript": "5.2.2"
"typescript": "^5.2.2"
}
}
8 changes: 4 additions & 4 deletions examples/audio_recorder/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from '../test/dfx_generated/audio_recorder';
import { get_tests } from './tests';
import { createActor } from './dfx_generated/audio_recorder';
import { getTests } from './tests';

const audio_recorder_canister = createActor(getCanisterId('audio_recorder'), {
agentOptions: {
host: 'http://127.0.0.1:8000'
}
});

runTests(get_tests(audio_recorder_canister));
runTests(getTests(audio_recorder_canister));
4 changes: 2 additions & 2 deletions examples/audio_recorder/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActorSubclass } from '@dfinity/agent';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

// @ts-ignore this path may not exist when these tests are imported into other test projects
import { _SERVICE } from './dfx_generated/audio_recorder/audio_recorder.did';
Expand All @@ -9,7 +9,7 @@ import { _SERVICE } from './dfx_generated/audio_recorder/audio_recorder.did';
let global_user: any;
let global_recording: any;

export function get_tests(
export function getTests(
audio_recorder_canister: ActorSubclass<_SERVICE>
): Test {
return () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/autoreload/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { getTests } from './tests';

Expand Down
2 changes: 1 addition & 1 deletion examples/autoreload/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, it, please, Test, wait } from 'azle/test/jest';
import { expect, it, please, Test, wait } from 'azle/test';
import { writeFileSync } from 'fs';

import {
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_bitcoin/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { afterAll, beforeAll, describe } from '@jest/globals';
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { BitcoinDaemon, startBitcoinDaemon } from './bitcoin_daemon';
import { getP2pkhAddress, getTests, P2PKH_ADDRESS_FORM } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_bitcoin/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { beforeAll } from '@jest/globals';
import { GetUtxosResult, Utxo } from 'azle/canisters/management';
import { jsonParse, jsonStringify } from 'azle/experimental';
import { expect, it, please, Test, wait } from 'azle/test/jest';
import { expect, it, please, Test, wait } from 'azle/test';
import { Transaction } from 'bitcoinjs-lib';

import {
Expand Down
2 changes: 1 addition & 1 deletion examples/bitcoin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"jest": "^29.7.0",
"ts-jest": "^29.1.4",
"ts-node": "10.7.0",
"typescript": "5.2.2"
"typescript": "^5.2.2"
}
}
2 changes: 1 addition & 1 deletion examples/bitcoin/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { afterAll, beforeAll, describe } from '@jest/globals';
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from './dfx_generated/bitcoin';
import { BitcoinDaemon, startBitcoinDaemon } from './setup';
Expand Down
2 changes: 1 addition & 1 deletion examples/bitcoin/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActorSubclass } from '@dfinity/agent';
import { afterAll, beforeAll } from '@jest/globals';
import { expect, it, please, Test, wait } from 'azle/test/jest';
import { expect, it, please, Test, wait } from 'azle/test';

import { bitcoinCli } from './bitcoin_cli';
// @ts-ignore this path may not exist when these tests are imported into other test projects
Expand Down
2 changes: 1 addition & 1 deletion examples/bitcoin_psbt/test/manual.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';
import { getTests } from 'basic_bitcoin/test/tests';

import { getP2wpkhAddress, P2WPKH_ADDRESS_FORM } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/bitcoin_psbt/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { afterAll, beforeAll, describe } from '@jest/globals';
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';
import {
BitcoinDaemon,
startBitcoinDaemon
Expand Down
2 changes: 1 addition & 1 deletion examples/bitcoinjs_lib/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { getTests } from './tests';

Expand Down
2 changes: 1 addition & 1 deletion examples/bitcoinjs_lib/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe } from '@jest/globals';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';
import { getTests as getBitcoinTests } from 'bitcore_lib_example/test/tests';

export function getTests(canisterId: string): Test {
Expand Down
2 changes: 1 addition & 1 deletion examples/bitcore_lib/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { getTests } from './tests';

Expand Down
2 changes: 1 addition & 1 deletion examples/bitcore_lib/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

export function getTests(canisterId: string): Test {
const origin = `http://${canisterId}.localhost:8000`;
Expand Down
2 changes: 1 addition & 1 deletion examples/blob_array/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from './dfx_generated/blob_array';
import { getTests } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/blob_array/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActorSubclass } from '@dfinity/agent';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

// @ts-ignore this path may not exist when these tests are imported into other test projects
import { _SERVICE } from './dfx_generated/blob_array/blob_array.did';
Expand Down
2 changes: 1 addition & 1 deletion examples/bytes/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from './dfx_generated/bytes_canister';
import { getTests } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/bytes/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActorSubclass } from '@dfinity/agent';
import { describe } from '@jest/globals';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';
import { readFileSync } from 'fs';

import { _SERVICE } from './dfx_generated/bytes_canister/bytes_canister.did.d';
Expand Down
4 changes: 2 additions & 2 deletions examples/call_raw/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from '../test/dfx_generated/call_raw';
import { createActor } from './dfx_generated/call_raw';
import { getTests } from './tests';

const callRawCanister = createActor(getCanisterId('call_raw'), {
Expand Down
2 changes: 1 addition & 1 deletion examples/call_raw/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActorSubclass } from '@dfinity/agent';
import { Principal } from '@dfinity/principal';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

// @ts-ignore this path may not exist when these tests are imported into other test projects
import { _SERVICE } from './dfx_generated/call_raw/call_raw.did';
Expand Down
2 changes: 1 addition & 1 deletion examples/candid_encoding/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from './dfx_generated/candid_encoding';
import { getTests } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/candid_encoding/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActorSubclass } from '@dfinity/agent';
import { describe } from '@jest/globals';
import { expect, it, please, Test } from 'azle/test/jest';
import { expect, it, please, Test } from 'azle/test';
import { execSync } from 'child_process';

// @ts-ignore this path may not exist when these tests are imported into other test projects
Expand Down
2 changes: 1 addition & 1 deletion examples/candid_keywords/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"jest": "^29.7.0",
"ts-jest": "^29.1.4",
"ts-node": "10.9.0",
"typescript": "5.2.2"
"typescript": "^5.2.2"
}
}
2 changes: 1 addition & 1 deletion examples/candid_keywords/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from './dfx_generated/candid_keywords';
import { getTests } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/candid_keywords/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActorSubclass } from '@dfinity/agent';
import { Principal } from '@dfinity/principal';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

// @ts-ignore this path may not exist when these tests are imported into other test projects
import { _SERVICE } from './dfx_generated/candid_keywords/candid_keywords.did';
Expand Down
2 changes: 1 addition & 1 deletion examples/canister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"jest": "^29.7.0",
"ts-jest": "^29.1.4",
"ts-node": "10.7.0",
"typescript": "5.2.2"
"typescript": "^5.2.2"
}
}
2 changes: 1 addition & 1 deletion examples/canister/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from './dfx_generated/canister';
import { getTests } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/canister/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ActorSubclass } from '@dfinity/agent';
import { Principal } from '@dfinity/principal';
import { getCanisterId } from 'azle/dfx';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

// @ts-ignore this path may not exist when these tests are imported into other test projects
import { _SERVICE } from './dfx_generated/canister/canister.did';
Expand Down
2 changes: 1 addition & 1 deletion examples/ckbtc/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterAll, beforeAll, describe } from '@jest/globals';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';
import { ChildProcessWithoutNullStreams, spawn } from 'child_process';
import { existsSync, rmSync } from 'fs-extra';

Expand Down
2 changes: 1 addition & 1 deletion examples/ckbtc/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ActorSubclass } from '@dfinity/agent';
import { Identity } from '@dfinity/agent';
import { Ed25519KeyIdentity } from '@dfinity/identity';
import { getCanisterId } from 'azle/dfx';
import { expect, it, please, Test, wait } from 'azle/test/jest';
import { expect, it, please, Test, wait } from 'azle/test';
import { execSync } from 'child_process';

// @ts-ignore
Expand Down
7 changes: 3 additions & 4 deletions examples/complex_init/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { describe } from '@jest/globals';
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor as createComplexActor } from '../test/dfx_generated/complex_init';
// @ts-ignore
import { createActor as createRecActor } from '../test/dfx_generated/rec_init';
import { createActor as createComplexActor } from './dfx_generated/complex_init';
import { createActor as createRecActor } from './dfx_generated/rec_init';
import { getRecTests, getTests } from './tests';

const complexInitCanister = createComplexActor(getCanisterId('complex_init'), {
Expand Down
2 changes: 1 addition & 1 deletion examples/complex_init/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActorSubclass } from '@dfinity/agent';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

import { _SERVICE as _COMPLEX_SERVICE } from './dfx_generated/complex_init/complex_init.did';
// @ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion examples/complex_types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"jest": "^29.7.0",
"ts-jest": "^29.1.4",
"ts-node": "10.7.0",
"typescript": "5.2.2"
"typescript": "^5.2.2"
}
}
4 changes: 2 additions & 2 deletions examples/complex_types/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// TODO this needs to be more thoroughly tested

import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from '../test/dfx_generated/complex_types';
import { createActor } from './dfx_generated/complex_types';
import { getTests } from './tests';

const complex_types_canister = createActor(getCanisterId('complex_types'), {
Expand Down
2 changes: 1 addition & 1 deletion examples/complex_types/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActorSubclass } from '@dfinity/agent';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

import { User } from '../src/candid_types';
import { _SERVICE } from './dfx_generated/complex_types/complex_types.did.d';
Expand Down
2 changes: 1 addition & 1 deletion examples/composite_queries/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from './dfx_generated/canister1';
import { getTests } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/composite_queries/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActorSubclass } from '@dfinity/agent';
import { getCanisterId } from 'azle/dfx';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

// @ts-ignore this path may not exist when these tests are imported into other test projects
import { _SERVICE } from './dfx_generated/canister1/canister1.did';
Expand Down
2 changes: 1 addition & 1 deletion examples/counter/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor } from './dfx_generated/counter';
import { getTests } from './tests';
Expand Down
2 changes: 1 addition & 1 deletion examples/counter/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActorSubclass } from '@dfinity/agent';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

// @ts-ignore this path may not exist when these tests are imported into other test projects
import { _SERVICE } from './dfx_generated/counter/counter.did';
Expand Down
2 changes: 1 addition & 1 deletion examples/cross_canister_calls/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCanisterId } from 'azle/dfx';
import { runTests } from 'azle/test/jest';
import { runTests } from 'azle/test';

import { createActor as createActorCanister1 } from './dfx_generated/canister1';
import { createActor as createActorCanister2 } from './dfx_generated/canister2';
Expand Down
2 changes: 1 addition & 1 deletion examples/cross_canister_calls/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ActorSubclass } from '@dfinity/agent';
import { getCanisterId } from 'azle/dfx';
import { expect, it, Test } from 'azle/test/jest';
import { expect, it, Test } from 'azle/test';

import { _SERVICE as CANISTER1_SERVICE } from './dfx_generated/canister1/canister1.did';
import { _SERVICE as CANISTER2_SERVICE } from './dfx_generated/canister2/canister2.did';
Expand Down
Loading

0 comments on commit 9752896

Please sign in to comment.