From 96f8232bcb11336b7408c4eaa3e33a48ead43973 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 18 Dec 2024 13:18:34 -0700 Subject: [PATCH 01/13] add throw to find prop tests that don't use this function --- test/index.ts | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/test/index.ts b/test/index.ts index fecda4c404..32b3235de0 100644 --- a/test/index.ts +++ b/test/index.ts @@ -6,7 +6,6 @@ import { describe, expect, test } from '@jest/globals'; import * as fc from 'fast-check'; import { join } from 'path'; -import { getCanisterId } from '../dfx'; import { execSyncPretty } from '../src/build/stable/utils/exec_sync_pretty'; export { expect } from '@jest/globals'; import { runBenchmarksForCanisters } from './benchmarks'; @@ -120,26 +119,9 @@ type GetCanisterActorOptions = { export async function getCanisterActor( canisterName: string, - options: GetCanisterActorOptions = {} + _options: GetCanisterActorOptions = {} ): Promise> { - const { createActor } = await import( - join(process.cwd(), 'test', 'dfx_generated', canisterName) - ); - - const agent = - options.agent ?? - new HttpAgent({ - host: 'http://127.0.0.1:8000', - identity: options.identity - }); - - if (process.env.DFX_NETWORK !== 'ic') { - await agent.fetchRootKey(); - } - - return createActor(getCanisterId(canisterName), { - agent - }); + throw new Error('This prop tests uses getCanisterActor and is good to go'); } function processEnvVars(): { From 5d4d45add584b8128b801a5eef1bf178dfef2153 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 19 Dec 2024 09:53:35 -0700 Subject: [PATCH 02/13] update prop tests to use getCanisterActor --- test/index.ts | 32 ++++++++++++++++++++++++++++---- test/property/get_actor.ts | 19 ++++++------------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/test/index.ts b/test/index.ts index 32b3235de0..aa4f67b16b 100644 --- a/test/index.ts +++ b/test/index.ts @@ -1,13 +1,14 @@ import * as dns from 'node:dns'; dns.setDefaultResultOrder('ipv4first'); -import { ActorSubclass, HttpAgent, Identity } from '@dfinity/agent'; +import { ActorSubclass, Agent, HttpAgent, Identity } from '@dfinity/agent'; import { describe, expect, test } from '@jest/globals'; import * as fc from 'fast-check'; import { join } from 'path'; import { execSyncPretty } from '../src/build/stable/utils/exec_sync_pretty'; export { expect } from '@jest/globals'; +import { getCanisterId } from '../dfx'; import { runBenchmarksForCanisters } from './benchmarks'; import { runFuzzTests } from './fuzz'; @@ -114,14 +115,37 @@ export function defaultPropTestParams(): fc.Parameters { type GetCanisterActorOptions = { identity?: Identity; - agent?: HttpAgent; + agent?: Agent; + parentDir?: string; }; export async function getCanisterActor( canisterName: string, - _options: GetCanisterActorOptions = {} + options: GetCanisterActorOptions = {} ): Promise> { - throw new Error('This prop tests uses getCanisterActor and is good to go'); + const parentDir = options.parentDir ?? join(process.cwd(), 'test'); + const { createActor } = await import( + join(parentDir, 'dfx_generated', canisterName) + ); + + const agent = + options.agent ?? + (await HttpAgent.create({ + host: 'http://127.0.0.1:8000', + shouldFetchRootKey: true + })); + + const actor = createActor(getCanisterId(canisterName), { + agent + }); + + if (typeof canisterName === 'string') { + throw new Error( + 'This prop tests uses getCanisterActor and is good to go' + ); + } + + return actor; } function processEnvVars(): { diff --git a/test/property/get_actor.ts b/test/property/get_actor.ts index 9b6bc00735..c81bd5b822 100644 --- a/test/property/get_actor.ts +++ b/test/property/get_actor.ts @@ -1,8 +1,8 @@ -import { Agent, HttpAgent } from '@dfinity/agent'; +import { Agent } from '@dfinity/agent'; -import { getCanisterId } from '../../dfx'; +import { getCanisterActor } from '../index'; -export function getActor(parentDir: string, agent?: Agent): any { +export async function getActor(parentDir: string, agent?: Agent): Promise { const resolvedPathIndex = require.resolve( `${parentDir}/dfx_generated/canister/index.js` ); @@ -13,15 +13,8 @@ export function getActor(parentDir: string, agent?: Agent): any { delete require.cache[resolvedPathIndex]; delete require.cache[resolvedPathDid]; - // eslint-disable-next-line @typescript-eslint/no-require-imports - const { createActor } = require(`${parentDir}/dfx_generated/canister`); - - return createActor(getCanisterId('canister'), { - agent: - agent ?? - new HttpAgent({ - host: 'http://127.0.0.1:8000', - verifyQuerySignatures: false // TODO Major issue: https://forum.dfinity.org/t/agent-js-0-20-0-is-released-replica-signed-query-edition/24743/16?u=lastmjs - }) + return getCanisterActor('canister', { + parentDir, + agent }); } From c991337f9c84b41eed95a6097c40838308dca30f Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 19 Dec 2024 10:31:18 -0700 Subject: [PATCH 03/13] move getCanisterActor into separte file to avoid jest --- test/get_canister_actor.ts | 41 ++++++++++++++++++++++++++++++++++++++ test/index.ts | 39 ++---------------------------------- test/property/get_actor.ts | 2 +- 3 files changed, 44 insertions(+), 38 deletions(-) create mode 100644 test/get_canister_actor.ts diff --git a/test/get_canister_actor.ts b/test/get_canister_actor.ts new file mode 100644 index 0000000000..6fe9a12fb2 --- /dev/null +++ b/test/get_canister_actor.ts @@ -0,0 +1,41 @@ +import { HttpAgent, Identity } from '@dfinity/agent'; +import { ActorSubclass } from '@dfinity/agent'; +import { Agent } from '@dfinity/agent'; +import { join } from 'path'; + +import { getCanisterId } from '../dfx'; + +type GetCanisterActorOptions = { + identity?: Identity; + agent?: Agent; + parentDir?: string; +}; + +export async function getCanisterActor( + canisterName: string, + options: GetCanisterActorOptions = {} +): Promise> { + const parentDir = options.parentDir ?? join(process.cwd(), 'test'); + const { createActor } = await import( + join(parentDir, 'dfx_generated', canisterName) + ); + + const agent = + options.agent ?? + (await HttpAgent.create({ + host: 'http://127.0.0.1:8000', + shouldFetchRootKey: true + })); + + const actor = createActor(getCanisterId(canisterName), { + agent + }); + + if (typeof canisterName === 'string') { + throw new Error( + 'This prop tests uses getCanisterActor and is good to go' + ); + } + + return actor; +} diff --git a/test/index.ts b/test/index.ts index aa4f67b16b..61bcb8ec09 100644 --- a/test/index.ts +++ b/test/index.ts @@ -1,19 +1,19 @@ import * as dns from 'node:dns'; dns.setDefaultResultOrder('ipv4first'); -import { ActorSubclass, Agent, HttpAgent, Identity } from '@dfinity/agent'; import { describe, expect, test } from '@jest/globals'; import * as fc from 'fast-check'; import { join } from 'path'; import { execSyncPretty } from '../src/build/stable/utils/exec_sync_pretty'; export { expect } from '@jest/globals'; -import { getCanisterId } from '../dfx'; import { runBenchmarksForCanisters } from './benchmarks'; import { runFuzzTests } from './fuzz'; export type Test = () => void; +export { getCanisterActor } from './get_canister_actor'; + export function runTests( tests: Test, canisterNames: string | string[] | undefined = undefined, @@ -113,41 +113,6 @@ export function defaultPropTestParams(): fc.Parameters { return seed !== undefined ? { ...baseParams, seed, path } : baseParams; } -type GetCanisterActorOptions = { - identity?: Identity; - agent?: Agent; - parentDir?: string; -}; - -export async function getCanisterActor( - canisterName: string, - options: GetCanisterActorOptions = {} -): Promise> { - const parentDir = options.parentDir ?? join(process.cwd(), 'test'); - const { createActor } = await import( - join(parentDir, 'dfx_generated', canisterName) - ); - - const agent = - options.agent ?? - (await HttpAgent.create({ - host: 'http://127.0.0.1:8000', - shouldFetchRootKey: true - })); - - const actor = createActor(getCanisterId(canisterName), { - agent - }); - - if (typeof canisterName === 'string') { - throw new Error( - 'This prop tests uses getCanisterActor and is good to go' - ); - } - - return actor; -} - function processEnvVars(): { shouldRunTests: boolean; shouldRunTypeChecks: boolean; diff --git a/test/property/get_actor.ts b/test/property/get_actor.ts index c81bd5b822..f18d33bb61 100644 --- a/test/property/get_actor.ts +++ b/test/property/get_actor.ts @@ -1,6 +1,6 @@ import { Agent } from '@dfinity/agent'; -import { getCanisterActor } from '../index'; +import { getCanisterActor } from '../get_canister_actor'; export async function getActor(parentDir: string, agent?: Agent): Promise { const resolvedPathIndex = require.resolve( From def89968bf3adeb8e50cf6118f95e2e5b7734c8c Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 19 Dec 2024 11:23:10 -0700 Subject: [PATCH 04/13] await get actor --- .../test/property/candid_rpc/blob/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/bool/test/generate_tests.ts | 2 +- .../http_request_update/test/generate_tests.ts | 4 ++-- .../candid_rpc/canister_methods/init/test/generate_tests.ts | 2 +- .../canister_methods/inspect_message/test/generate_tests.ts | 2 +- .../canister_methods/query/test/generate_tests.ts | 2 +- .../canister_methods/update/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/float32/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/float64/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/func/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int16/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int32/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int64/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int8/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat16/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat32/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat64/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat8/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/null/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/opt/test/generate_tests.ts | 2 +- .../property/candid_rpc/principal/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/record/test/generate_tests.ts | 2 +- .../property/candid_rpc/recursive/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/text/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/tuple/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/variant/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/vec/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/blob/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/bool/test/generate_tests.ts | 2 +- .../http_request_update/test/generate_tests.ts | 4 ++-- .../candid_rpc/canister_methods/init/test/generate_tests.ts | 2 +- .../canister_methods/inspect_message/test/generate_tests.ts | 2 +- .../canister_methods/query/test/generate_tests.ts | 2 +- .../canister_methods/update/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/float32/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/float64/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/func/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int16/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int32/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int64/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/int8/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat16/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat32/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat64/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/nat8/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/null/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/opt/test/generate_tests.ts | 2 +- .../property/candid_rpc/principal/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/record/test/generate_tests.ts | 2 +- .../property/candid_rpc/recursive/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/text/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/tuple/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/variant/test/generate_tests.ts | 2 +- .../test/property/candid_rpc/vec/test/generate_tests.ts | 2 +- test/get_canister_actor.ts | 6 ------ 59 files changed, 60 insertions(+), 66 deletions(-) diff --git a/examples/experimental/test/property/candid_rpc/blob/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/blob/test/generate_tests.ts index 486dfabddd..4d2d17aef4 100644 --- a/examples/experimental/test/property/candid_rpc/blob/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/blob/test/generate_tests.ts @@ -21,7 +21,7 @@ export function generateTests( { name: `blob ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...paramBlobs.map( diff --git a/examples/experimental/test/property/candid_rpc/bool/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/bool/test/generate_tests.ts index f502a7d3d1..7f0a73a99f 100644 --- a/examples/experimental/test/property/candid_rpc/bool/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/bool/test/generate_tests.ts @@ -20,7 +20,7 @@ export function generateTests( { name: `bool ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/canister_methods/http_request_update/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/canister_methods/http_request_update/test/generate_tests.ts index 7b0a90a19b..597741596a 100644 --- a/examples/experimental/test/property/candid_rpc/canister_methods/http_request_update/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/canister_methods/http_request_update/test/generate_tests.ts @@ -22,7 +22,7 @@ export function generateTests( { name: 'get state before calling http_request', test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor['get_state'](); @@ -62,7 +62,7 @@ export function generateTests( { name: 'get state after calling http_request', test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor['get_state'](); diff --git a/examples/experimental/test/property/candid_rpc/canister_methods/init/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/canister_methods/init/test/generate_tests.ts index 7cc3865499..5cde0888b6 100644 --- a/examples/experimental/test/property/candid_rpc/canister_methods/init/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/canister_methods/init/test/generate_tests.ts @@ -17,7 +17,7 @@ export function generateTests( { name: `init method`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor.getInitValues(); return testEquality(result, expectedResult); diff --git a/examples/experimental/test/property/candid_rpc/canister_methods/inspect_message/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/canister_methods/inspect_message/test/generate_tests.ts index ddfeb1baf2..7502996ae5 100644 --- a/examples/experimental/test/property/candid_rpc/canister_methods/inspect_message/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/canister_methods/inspect_message/test/generate_tests.ts @@ -43,7 +43,7 @@ function generateTest( name: `method "${functionName}" expected ${behavior}`, test: async (): Promise => { await agent.fetchRootKey(); - const actor = getActor(__dirname, agent); + const actor = await getActor(__dirname, agent); try { const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/canister_methods/query/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/canister_methods/query/test/generate_tests.ts index 3f03f5b327..5ac5f31add 100644 --- a/examples/experimental/test/property/candid_rpc/canister_methods/query/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/canister_methods/query/test/generate_tests.ts @@ -19,7 +19,7 @@ export function generateTests( { name: `query method "${functionName}"`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); return testEquality(result, expectedResult); } diff --git a/examples/experimental/test/property/candid_rpc/canister_methods/update/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/canister_methods/update/test/generate_tests.ts index f822f5fefe..6720c4c77f 100644 --- a/examples/experimental/test/property/candid_rpc/canister_methods/update/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/canister_methods/update/test/generate_tests.ts @@ -19,7 +19,7 @@ export function generateTests( { name: `update method "${functionName}"`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); return testEquality(result, expectedResult); diff --git a/examples/experimental/test/property/candid_rpc/float32/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/float32/test/generate_tests.ts index 8d06ffb8c1..ab28fd4159 100644 --- a/examples/experimental/test/property/candid_rpc/float32/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/float32/test/generate_tests.ts @@ -19,7 +19,7 @@ export function generateTests( { name: `float32 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/float64/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/float64/test/generate_tests.ts index a1b96c9d69..0bb2db14e0 100644 --- a/examples/experimental/test/property/candid_rpc/float64/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/float64/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `float64 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/func/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/func/test/generate_tests.ts index 6f43b31d48..0d2cf20228 100644 --- a/examples/experimental/test/property/candid_rpc/func/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/func/test/generate_tests.ts @@ -13,7 +13,7 @@ export function generateTests( { name: `func ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamFuncs.map( diff --git a/examples/experimental/test/property/candid_rpc/int/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/int/test/generate_tests.ts index d371cab3d8..22f52c4c50 100644 --- a/examples/experimental/test/property/candid_rpc/int/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/int/test/generate_tests.ts @@ -20,7 +20,7 @@ export function generateTests( { name: `int ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/int16/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/int16/test/generate_tests.ts index ca7736f384..c5e5f9b20b 100644 --- a/examples/experimental/test/property/candid_rpc/int16/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/int16/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `int16 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/int32/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/int32/test/generate_tests.ts index aca24d4e9e..5a500004c9 100644 --- a/examples/experimental/test/property/candid_rpc/int32/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/int32/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `int32 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/int64/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/int64/test/generate_tests.ts index d4c9ee1e05..ade85e0c06 100644 --- a/examples/experimental/test/property/candid_rpc/int64/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/int64/test/generate_tests.ts @@ -22,7 +22,7 @@ export function generateTests( { name: `int64 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/int8/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/int8/test/generate_tests.ts index 2895ddb7b8..6033e52f41 100644 --- a/examples/experimental/test/property/candid_rpc/int8/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/int8/test/generate_tests.ts @@ -22,7 +22,7 @@ export function generateTests( { name: `test ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/nat/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/nat/test/generate_tests.ts index 88de4ee05b..5bb7c56794 100644 --- a/examples/experimental/test/property/candid_rpc/nat/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/nat/test/generate_tests.ts @@ -20,7 +20,7 @@ export function generateTests( { name: `nat ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/nat16/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/nat16/test/generate_tests.ts index 8830422ece..ecca58df70 100644 --- a/examples/experimental/test/property/candid_rpc/nat16/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/nat16/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `nat16 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/nat32/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/nat32/test/generate_tests.ts index cb3c408713..a535493371 100644 --- a/examples/experimental/test/property/candid_rpc/nat32/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/nat32/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `nat32 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/nat64/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/nat64/test/generate_tests.ts index 0c1b787e13..fbd38252d4 100644 --- a/examples/experimental/test/property/candid_rpc/nat64/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/nat64/test/generate_tests.ts @@ -22,7 +22,7 @@ export function generateTests( { name: `nat64 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/nat8/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/nat8/test/generate_tests.ts index 00b271b245..f174bd5e2d 100644 --- a/examples/experimental/test/property/candid_rpc/nat8/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/nat8/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `nat8 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/null/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/null/test/generate_tests.ts index b768bdc13a..57944c1b50 100644 --- a/examples/experimental/test/property/candid_rpc/null/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/null/test/generate_tests.ts @@ -12,7 +12,7 @@ export function generateTests( { name: `test ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamNulls.map( diff --git a/examples/experimental/test/property/candid_rpc/opt/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/opt/test/generate_tests.ts index 8061de7166..9ff9e2ecdd 100644 --- a/examples/experimental/test/property/candid_rpc/opt/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/opt/test/generate_tests.ts @@ -15,7 +15,7 @@ export function generateTests( { name: `opt ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const params = namedParamOpts.map( (param) => param.value.value.agentArgumentValue diff --git a/examples/experimental/test/property/candid_rpc/principal/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/principal/test/generate_tests.ts index fad105f8fb..33707ce3f9 100644 --- a/examples/experimental/test/property/candid_rpc/principal/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/principal/test/generate_tests.ts @@ -18,7 +18,7 @@ export function generateTests( { name: `principal ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamPrincipals.map( (param) => param.value.value.agentArgumentValue diff --git a/examples/experimental/test/property/candid_rpc/record/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/record/test/generate_tests.ts index dbcbc2348a..aba1af3919 100644 --- a/examples/experimental/test/property/candid_rpc/record/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/record/test/generate_tests.ts @@ -13,7 +13,7 @@ export function generateTests( { name: `record ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamRecords.map( diff --git a/examples/experimental/test/property/candid_rpc/recursive/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/recursive/test/generate_tests.ts index f051ae2125..7b7d82fb7a 100644 --- a/examples/experimental/test/property/candid_rpc/recursive/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/recursive/test/generate_tests.ts @@ -13,7 +13,7 @@ export function generateTests( { name: `recursive ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const params = namedParamRecursive.map( (param) => param.value.value.agentArgumentValue diff --git a/examples/experimental/test/property/candid_rpc/text/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/text/test/generate_tests.ts index 864fad0251..50693f97c9 100644 --- a/examples/experimental/test/property/candid_rpc/text/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/text/test/generate_tests.ts @@ -20,7 +20,7 @@ export function generateTests( { name: `text ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/experimental/test/property/candid_rpc/tuple/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/tuple/test/generate_tests.ts index 387be4ae21..2b2fa75e24 100644 --- a/examples/experimental/test/property/candid_rpc/tuple/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/tuple/test/generate_tests.ts @@ -18,7 +18,7 @@ export function generateTests( { name: `tuple ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamTuples.map( diff --git a/examples/experimental/test/property/candid_rpc/variant/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/variant/test/generate_tests.ts index 540ee8ead8..7aea8d7578 100644 --- a/examples/experimental/test/property/candid_rpc/variant/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/variant/test/generate_tests.ts @@ -15,7 +15,7 @@ export function generateTests( { name: `variant ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamVariants.map( diff --git a/examples/experimental/test/property/candid_rpc/vec/test/generate_tests.ts b/examples/experimental/test/property/candid_rpc/vec/test/generate_tests.ts index 682face3fd..0698290527 100644 --- a/examples/experimental/test/property/candid_rpc/vec/test/generate_tests.ts +++ b/examples/experimental/test/property/candid_rpc/vec/test/generate_tests.ts @@ -14,7 +14,7 @@ export function generateTests( { name: `vec ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const params = namedParamVecs.map( (param) => param.value.value.agentArgumentValue diff --git a/examples/stable/test/property/candid_rpc/blob/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/blob/test/generate_tests.ts index 486dfabddd..4d2d17aef4 100644 --- a/examples/stable/test/property/candid_rpc/blob/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/blob/test/generate_tests.ts @@ -21,7 +21,7 @@ export function generateTests( { name: `blob ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...paramBlobs.map( diff --git a/examples/stable/test/property/candid_rpc/bool/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/bool/test/generate_tests.ts index f502a7d3d1..7f0a73a99f 100644 --- a/examples/stable/test/property/candid_rpc/bool/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/bool/test/generate_tests.ts @@ -20,7 +20,7 @@ export function generateTests( { name: `bool ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/canister_methods/http_request_update/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/canister_methods/http_request_update/test/generate_tests.ts index 7b0a90a19b..597741596a 100644 --- a/examples/stable/test/property/candid_rpc/canister_methods/http_request_update/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/canister_methods/http_request_update/test/generate_tests.ts @@ -22,7 +22,7 @@ export function generateTests( { name: 'get state before calling http_request', test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor['get_state'](); @@ -62,7 +62,7 @@ export function generateTests( { name: 'get state after calling http_request', test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor['get_state'](); diff --git a/examples/stable/test/property/candid_rpc/canister_methods/init/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/canister_methods/init/test/generate_tests.ts index 7cc3865499..5cde0888b6 100644 --- a/examples/stable/test/property/candid_rpc/canister_methods/init/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/canister_methods/init/test/generate_tests.ts @@ -17,7 +17,7 @@ export function generateTests( { name: `init method`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor.getInitValues(); return testEquality(result, expectedResult); diff --git a/examples/stable/test/property/candid_rpc/canister_methods/inspect_message/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/canister_methods/inspect_message/test/generate_tests.ts index ddfeb1baf2..7502996ae5 100644 --- a/examples/stable/test/property/candid_rpc/canister_methods/inspect_message/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/canister_methods/inspect_message/test/generate_tests.ts @@ -43,7 +43,7 @@ function generateTest( name: `method "${functionName}" expected ${behavior}`, test: async (): Promise => { await agent.fetchRootKey(); - const actor = getActor(__dirname, agent); + const actor = await getActor(__dirname, agent); try { const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/canister_methods/query/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/canister_methods/query/test/generate_tests.ts index 3f03f5b327..5ac5f31add 100644 --- a/examples/stable/test/property/candid_rpc/canister_methods/query/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/canister_methods/query/test/generate_tests.ts @@ -19,7 +19,7 @@ export function generateTests( { name: `query method "${functionName}"`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); return testEquality(result, expectedResult); } diff --git a/examples/stable/test/property/candid_rpc/canister_methods/update/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/canister_methods/update/test/generate_tests.ts index f822f5fefe..6720c4c77f 100644 --- a/examples/stable/test/property/candid_rpc/canister_methods/update/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/canister_methods/update/test/generate_tests.ts @@ -19,7 +19,7 @@ export function generateTests( { name: `update method "${functionName}"`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); return testEquality(result, expectedResult); diff --git a/examples/stable/test/property/candid_rpc/float32/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/float32/test/generate_tests.ts index 8d06ffb8c1..ab28fd4159 100644 --- a/examples/stable/test/property/candid_rpc/float32/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/float32/test/generate_tests.ts @@ -19,7 +19,7 @@ export function generateTests( { name: `float32 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/float64/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/float64/test/generate_tests.ts index a1b96c9d69..0bb2db14e0 100644 --- a/examples/stable/test/property/candid_rpc/float64/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/float64/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `float64 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/func/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/func/test/generate_tests.ts index 6f43b31d48..0d2cf20228 100644 --- a/examples/stable/test/property/candid_rpc/func/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/func/test/generate_tests.ts @@ -13,7 +13,7 @@ export function generateTests( { name: `func ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamFuncs.map( diff --git a/examples/stable/test/property/candid_rpc/int/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/int/test/generate_tests.ts index d371cab3d8..22f52c4c50 100644 --- a/examples/stable/test/property/candid_rpc/int/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/int/test/generate_tests.ts @@ -20,7 +20,7 @@ export function generateTests( { name: `int ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/int16/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/int16/test/generate_tests.ts index ca7736f384..c5e5f9b20b 100644 --- a/examples/stable/test/property/candid_rpc/int16/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/int16/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `int16 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/int32/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/int32/test/generate_tests.ts index aca24d4e9e..5a500004c9 100644 --- a/examples/stable/test/property/candid_rpc/int32/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/int32/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `int32 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/int64/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/int64/test/generate_tests.ts index d4c9ee1e05..ade85e0c06 100644 --- a/examples/stable/test/property/candid_rpc/int64/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/int64/test/generate_tests.ts @@ -22,7 +22,7 @@ export function generateTests( { name: `int64 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/int8/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/int8/test/generate_tests.ts index 2895ddb7b8..6033e52f41 100644 --- a/examples/stable/test/property/candid_rpc/int8/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/int8/test/generate_tests.ts @@ -22,7 +22,7 @@ export function generateTests( { name: `test ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/nat/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/nat/test/generate_tests.ts index 88de4ee05b..5bb7c56794 100644 --- a/examples/stable/test/property/candid_rpc/nat/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/nat/test/generate_tests.ts @@ -20,7 +20,7 @@ export function generateTests( { name: `nat ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/nat16/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/nat16/test/generate_tests.ts index 8830422ece..ecca58df70 100644 --- a/examples/stable/test/property/candid_rpc/nat16/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/nat16/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `nat16 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/nat32/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/nat32/test/generate_tests.ts index cb3c408713..a535493371 100644 --- a/examples/stable/test/property/candid_rpc/nat32/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/nat32/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `nat32 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/nat64/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/nat64/test/generate_tests.ts index 0c1b787e13..fbd38252d4 100644 --- a/examples/stable/test/property/candid_rpc/nat64/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/nat64/test/generate_tests.ts @@ -22,7 +22,7 @@ export function generateTests( { name: `nat64 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/nat8/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/nat8/test/generate_tests.ts index 00b271b245..f174bd5e2d 100644 --- a/examples/stable/test/property/candid_rpc/nat8/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/nat8/test/generate_tests.ts @@ -23,7 +23,7 @@ export function generateTests( { name: `nat8 ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/null/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/null/test/generate_tests.ts index b768bdc13a..57944c1b50 100644 --- a/examples/stable/test/property/candid_rpc/null/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/null/test/generate_tests.ts @@ -12,7 +12,7 @@ export function generateTests( { name: `test ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamNulls.map( diff --git a/examples/stable/test/property/candid_rpc/opt/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/opt/test/generate_tests.ts index 8061de7166..9ff9e2ecdd 100644 --- a/examples/stable/test/property/candid_rpc/opt/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/opt/test/generate_tests.ts @@ -15,7 +15,7 @@ export function generateTests( { name: `opt ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const params = namedParamOpts.map( (param) => param.value.value.agentArgumentValue diff --git a/examples/stable/test/property/candid_rpc/principal/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/principal/test/generate_tests.ts index fad105f8fb..33707ce3f9 100644 --- a/examples/stable/test/property/candid_rpc/principal/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/principal/test/generate_tests.ts @@ -18,7 +18,7 @@ export function generateTests( { name: `principal ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamPrincipals.map( (param) => param.value.value.agentArgumentValue diff --git a/examples/stable/test/property/candid_rpc/record/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/record/test/generate_tests.ts index dbcbc2348a..aba1af3919 100644 --- a/examples/stable/test/property/candid_rpc/record/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/record/test/generate_tests.ts @@ -13,7 +13,7 @@ export function generateTests( { name: `record ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamRecords.map( diff --git a/examples/stable/test/property/candid_rpc/recursive/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/recursive/test/generate_tests.ts index f051ae2125..7b7d82fb7a 100644 --- a/examples/stable/test/property/candid_rpc/recursive/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/recursive/test/generate_tests.ts @@ -13,7 +13,7 @@ export function generateTests( { name: `recursive ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const params = namedParamRecursive.map( (param) => param.value.value.agentArgumentValue diff --git a/examples/stable/test/property/candid_rpc/text/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/text/test/generate_tests.ts index 864fad0251..50693f97c9 100644 --- a/examples/stable/test/property/candid_rpc/text/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/text/test/generate_tests.ts @@ -20,7 +20,7 @@ export function generateTests( { name: `text ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](...paramValues); diff --git a/examples/stable/test/property/candid_rpc/tuple/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/tuple/test/generate_tests.ts index 387be4ae21..2b2fa75e24 100644 --- a/examples/stable/test/property/candid_rpc/tuple/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/tuple/test/generate_tests.ts @@ -18,7 +18,7 @@ export function generateTests( { name: `tuple ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamTuples.map( diff --git a/examples/stable/test/property/candid_rpc/variant/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/variant/test/generate_tests.ts index 540ee8ead8..7aea8d7578 100644 --- a/examples/stable/test/property/candid_rpc/variant/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/variant/test/generate_tests.ts @@ -15,7 +15,7 @@ export function generateTests( { name: `variant ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( ...namedParamVariants.map( diff --git a/examples/stable/test/property/candid_rpc/vec/test/generate_tests.ts b/examples/stable/test/property/candid_rpc/vec/test/generate_tests.ts index 682face3fd..0698290527 100644 --- a/examples/stable/test/property/candid_rpc/vec/test/generate_tests.ts +++ b/examples/stable/test/property/candid_rpc/vec/test/generate_tests.ts @@ -14,7 +14,7 @@ export function generateTests( { name: `vec ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const params = namedParamVecs.map( (param) => param.value.value.agentArgumentValue diff --git a/test/get_canister_actor.ts b/test/get_canister_actor.ts index 6fe9a12fb2..a0e74735ea 100644 --- a/test/get_canister_actor.ts +++ b/test/get_canister_actor.ts @@ -31,11 +31,5 @@ export async function getCanisterActor( agent }); - if (typeof canisterName === 'string') { - throw new Error( - 'This prop tests uses getCanisterActor and is good to go' - ); - } - return actor; } From 1a96196b2e8a5f26fb66a69fa9b7cf3fa66da470 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 19 Dec 2024 11:43:08 -0700 Subject: [PATCH 05/13] pr fixes --- test/get_canister_actor.ts | 14 ++++++++++++++ test/property/get_actor.ts | 13 +++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/test/get_canister_actor.ts b/test/get_canister_actor.ts index a0e74735ea..2ff91dfca2 100644 --- a/test/get_canister_actor.ts +++ b/test/get_canister_actor.ts @@ -5,12 +5,26 @@ import { join } from 'path'; import { getCanisterId } from '../dfx'; +/** + * Options for getting a canister actor + * @interface GetCanisterActorOptions + * @property {Identity} [identity] - Optional identity for authentication + * @property {Agent} [agent] - Optional pre-configured agent + * @property {string} [parentDir] - Optional parent directory path for the dfx generated files + */ type GetCanisterActorOptions = { identity?: Identity; agent?: Agent; parentDir?: string; }; +/** + * Creates an actor instance for interacting with a canister + * @template T - The interface type of the actor + * @param {string} canisterName - Name of the canister to create an actor for + * @param {GetCanisterActorOptions} [options={}] - Configuration options + * @returns {Promise>} A promise that resolves to the actor instance + */ export async function getCanisterActor( canisterName: string, options: GetCanisterActorOptions = {} diff --git a/test/property/get_actor.ts b/test/property/get_actor.ts index f18d33bb61..bb01e4db15 100644 --- a/test/property/get_actor.ts +++ b/test/property/get_actor.ts @@ -1,8 +1,17 @@ -import { Agent } from '@dfinity/agent'; +import { ActorSubclass, Agent } from '@dfinity/agent'; import { getCanisterActor } from '../get_canister_actor'; -export async function getActor(parentDir: string, agent?: Agent): Promise { +/** + * Creates an actor instance with cache clearing functionality + * @param {string} parentDir - Parent directory path containing the dfx generated files + * @param {Agent} [agent] - Optional pre-configured agent + * @returns {Promise>} A promise that resolves to the actor instance + */ +export async function getActor( + parentDir: string, + agent?: Agent +): Promise> { const resolvedPathIndex = require.resolve( `${parentDir}/dfx_generated/canister/index.js` ); From c8e42f7017fc32888fac328330a75d9ff6b5a463 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 19 Dec 2024 11:49:33 -0700 Subject: [PATCH 06/13] clean up js docs --- test/get_canister_actor.ts | 17 ++++++----------- test/property/get_actor.ts | 6 +++--- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/test/get_canister_actor.ts b/test/get_canister_actor.ts index 2ff91dfca2..0cf819d567 100644 --- a/test/get_canister_actor.ts +++ b/test/get_canister_actor.ts @@ -5,25 +5,20 @@ import { join } from 'path'; import { getCanisterId } from '../dfx'; -/** - * Options for getting a canister actor - * @interface GetCanisterActorOptions - * @property {Identity} [identity] - Optional identity for authentication - * @property {Agent} [agent] - Optional pre-configured agent - * @property {string} [parentDir] - Optional parent directory path for the dfx generated files - */ type GetCanisterActorOptions = { + /** Optional identity for authentication */ identity?: Identity; + /** Optional pre-configured agent */ agent?: Agent; + /** Optional parent directory path for the dfx generated files */ parentDir?: string; }; /** * Creates an actor instance for interacting with a canister - * @template T - The interface type of the actor - * @param {string} canisterName - Name of the canister to create an actor for - * @param {GetCanisterActorOptions} [options={}] - Configuration options - * @returns {Promise>} A promise that resolves to the actor instance + * @param canisterName - Name of the canister to create an actor for + * @param options - Configuration options + * @returns A promise that resolves to the actor instance */ export async function getCanisterActor( canisterName: string, diff --git a/test/property/get_actor.ts b/test/property/get_actor.ts index bb01e4db15..0d9eb96410 100644 --- a/test/property/get_actor.ts +++ b/test/property/get_actor.ts @@ -4,9 +4,9 @@ import { getCanisterActor } from '../get_canister_actor'; /** * Creates an actor instance with cache clearing functionality - * @param {string} parentDir - Parent directory path containing the dfx generated files - * @param {Agent} [agent] - Optional pre-configured agent - * @returns {Promise>} A promise that resolves to the actor instance + * @param parentDir - Parent directory path containing the dfx generated files + * @param agent - Optional pre-configured agent + * @returns A promise that resolves to the actor instance */ export async function getActor( parentDir: string, From c512db8ebbd7f3741b10170656695c1256045a8c Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 19 Dec 2024 11:54:25 -0700 Subject: [PATCH 07/13] fix return type of getActor --- test/property/get_actor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/property/get_actor.ts b/test/property/get_actor.ts index 0d9eb96410..fe224d31c7 100644 --- a/test/property/get_actor.ts +++ b/test/property/get_actor.ts @@ -11,7 +11,7 @@ import { getCanisterActor } from '../get_canister_actor'; export async function getActor( parentDir: string, agent?: Agent -): Promise> { +): Promise & { [key: string]: any }> { const resolvedPathIndex = require.resolve( `${parentDir}/dfx_generated/canister/index.js` ); From b945d095bcf0a761e819851e3e0f84a9c75e5d26 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 19 Dec 2024 12:46:40 -0700 Subject: [PATCH 08/13] add cache busting --- examples/stable/test/property/ic_api/reply/test/tests.ts | 9 +++------ test/get_canister_actor.ts | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/stable/test/property/ic_api/reply/test/tests.ts b/examples/stable/test/property/ic_api/reply/test/tests.ts index 656387ecea..1a5129aa43 100644 --- a/examples/stable/test/property/ic_api/reply/test/tests.ts +++ b/examples/stable/test/property/ic_api/reply/test/tests.ts @@ -123,14 +123,11 @@ export async function getCanisterActor( const { createActor } = await import(importPath); - const agent = new HttpAgent({ - host: 'http://127.0.0.1:8000' + const agent = await HttpAgent.create({ + host: 'http://127.0.0.1:8000', + shouldFetchRootKey: true }); - if (process.env.DFX_NETWORK !== 'ic') { - await agent.fetchRootKey(); - } - const actor = createActor(getCanisterId(canisterName), { agent }); diff --git a/test/get_canister_actor.ts b/test/get_canister_actor.ts index 0cf819d567..4591472867 100644 --- a/test/get_canister_actor.ts +++ b/test/get_canister_actor.ts @@ -26,7 +26,7 @@ export async function getCanisterActor( ): Promise> { const parentDir = options.parentDir ?? join(process.cwd(), 'test'); const { createActor } = await import( - join(parentDir, 'dfx_generated', canisterName) + `${join(parentDir, 'dfx_generated', canisterName)}?t=${Date.now()}` ); const agent = From 738154700574f24dae15b5f6ea95c44c8e3d1b82 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 20 Dec 2024 10:04:46 -0700 Subject: [PATCH 09/13] dont use getCanisterActor in getActor for caching reasons --- test/get_canister_actor.ts | 2 +- test/property/get_actor.ts | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/test/get_canister_actor.ts b/test/get_canister_actor.ts index 4591472867..0cf819d567 100644 --- a/test/get_canister_actor.ts +++ b/test/get_canister_actor.ts @@ -26,7 +26,7 @@ export async function getCanisterActor( ): Promise> { const parentDir = options.parentDir ?? join(process.cwd(), 'test'); const { createActor } = await import( - `${join(parentDir, 'dfx_generated', canisterName)}?t=${Date.now()}` + join(parentDir, 'dfx_generated', canisterName) ); const agent = diff --git a/test/property/get_actor.ts b/test/property/get_actor.ts index fe224d31c7..70887aecec 100644 --- a/test/property/get_actor.ts +++ b/test/property/get_actor.ts @@ -1,6 +1,6 @@ -import { ActorSubclass, Agent } from '@dfinity/agent'; +import { ActorSubclass, Agent, HttpAgent } from '@dfinity/agent'; -import { getCanisterActor } from '../get_canister_actor'; +import { getCanisterId } from '../../dfx'; /** * Creates an actor instance with cache clearing functionality @@ -22,8 +22,15 @@ export async function getActor( delete require.cache[resolvedPathIndex]; delete require.cache[resolvedPathDid]; - return getCanisterActor('canister', { - parentDir, - agent + // eslint-disable-next-line @typescript-eslint/no-require-imports + const { createActor } = require(`${parentDir}/dfx_generated/canister`); + + return createActor(getCanisterId('canister'), { + agent: + agent ?? + (await HttpAgent.create({ + host: 'http://127.0.0.1:8000', + shouldFetchRootKey: true + })) }); } From 618b141265fa3db8360167387ebb021d4d23ebdb Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 20 Dec 2024 13:44:52 -0700 Subject: [PATCH 10/13] pr fix --- test/property/get_actor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/property/get_actor.ts b/test/property/get_actor.ts index 70887aecec..97b88d4d97 100644 --- a/test/property/get_actor.ts +++ b/test/property/get_actor.ts @@ -3,7 +3,7 @@ import { ActorSubclass, Agent, HttpAgent } from '@dfinity/agent'; import { getCanisterId } from '../../dfx'; /** - * Creates an actor instance with cache clearing functionality + * Creates an actor instance with require.cache (not ES module) clearing functionality * @param parentDir - Parent directory path containing the dfx generated files * @param agent - Optional pre-configured agent * @returns A promise that resolves to the actor instance From 1fa8c8c2c00d96cd20a1520e656373aa346969ec Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 20 Dec 2024 13:50:23 -0700 Subject: [PATCH 11/13] pr fix --- test/property/get_actor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/property/get_actor.ts b/test/property/get_actor.ts index 97b88d4d97..99fac9921c 100644 --- a/test/property/get_actor.ts +++ b/test/property/get_actor.ts @@ -3,7 +3,7 @@ import { ActorSubclass, Agent, HttpAgent } from '@dfinity/agent'; import { getCanisterId } from '../../dfx'; /** - * Creates an actor instance with require.cache (not ES module) clearing functionality + * Creates an actor instance with require (not ES module) cache clearing functionality * @param parentDir - Parent directory path containing the dfx generated files * @param agent - Optional pre-configured agent * @returns A promise that resolves to the actor instance From 2097d15af4d41143c6a1759cbf56c5cfa2b57276 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 20 Dec 2024 15:06:23 -0700 Subject: [PATCH 12/13] add back identity --- test/get_canister_actor.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/get_canister_actor.ts b/test/get_canister_actor.ts index 0cf819d567..a47cc52917 100644 --- a/test/get_canister_actor.ts +++ b/test/get_canister_actor.ts @@ -33,6 +33,7 @@ export async function getCanisterActor( options.agent ?? (await HttpAgent.create({ host: 'http://127.0.0.1:8000', + identity: options.identity, shouldFetchRootKey: true })); From a3672a6750a8378d519951124fc49eb04abe044a Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 20 Dec 2024 15:35:47 -0700 Subject: [PATCH 13/13] await get actor --- .../post_upgrade/test/generate_init_tests.ts | 2 +- .../post_upgrade/test/generate_post_upgrade_tests.ts | 2 +- .../candid_rpc/canister_methods/pre_upgrade/test/test.ts | 4 ++-- .../candid_rpc/stable_b_tree_map/test/contains_key.ts | 6 +++--- .../test/property/candid_rpc/stable_b_tree_map/test/get.ts | 6 +++--- .../property/candid_rpc/stable_b_tree_map/test/insert.ts | 2 +- .../property/candid_rpc/stable_b_tree_map/test/is_empty.ts | 6 +++--- .../property/candid_rpc/stable_b_tree_map/test/items.ts | 6 +++--- .../test/property/candid_rpc/stable_b_tree_map/test/keys.ts | 6 +++--- .../test/property/candid_rpc/stable_b_tree_map/test/len.ts | 6 +++--- .../property/candid_rpc/stable_b_tree_map/test/remove.ts | 2 +- .../property/candid_rpc/stable_b_tree_map/test/values.ts | 6 +++--- .../post_upgrade/test/generate_init_tests.ts | 2 +- .../post_upgrade/test/generate_post_upgrade_tests.ts | 2 +- .../candid_rpc/canister_methods/pre_upgrade/test/test.ts | 4 ++-- .../candid_rpc/stable_b_tree_map/test/contains_key.ts | 6 +++--- .../test/property/candid_rpc/stable_b_tree_map/test/get.ts | 6 +++--- .../property/candid_rpc/stable_b_tree_map/test/insert.ts | 2 +- .../property/candid_rpc/stable_b_tree_map/test/is_empty.ts | 6 +++--- .../property/candid_rpc/stable_b_tree_map/test/items.ts | 6 +++--- .../test/property/candid_rpc/stable_b_tree_map/test/keys.ts | 6 +++--- .../test/property/candid_rpc/stable_b_tree_map/test/len.ts | 6 +++--- .../property/candid_rpc/stable_b_tree_map/test/remove.ts | 2 +- .../property/candid_rpc/stable_b_tree_map/test/values.ts | 6 +++--- 24 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/experimental/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_init_tests.ts b/examples/experimental/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_init_tests.ts index b6c576d370..c47892e40e 100644 --- a/examples/experimental/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_init_tests.ts +++ b/examples/experimental/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_init_tests.ts @@ -17,7 +17,7 @@ export function generateTests( { name: `init method`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const initValues = await actor.getInitValues(); const isPostUpgradeCalled = diff --git a/examples/experimental/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts b/examples/experimental/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts index 7d9e9ddba4..79344d0cff 100644 --- a/examples/experimental/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts +++ b/examples/experimental/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts @@ -18,7 +18,7 @@ export function generateTests( { name: `post upgrade method`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const postUpgradeValues = await actor.getPostUpgradeValues(); diff --git a/examples/experimental/test/property/candid_rpc/canister_methods/pre_upgrade/test/test.ts b/examples/experimental/test/property/candid_rpc/canister_methods/pre_upgrade/test/test.ts index 11c82720cd..4b8001a4e6 100644 --- a/examples/experimental/test/property/candid_rpc/canister_methods/pre_upgrade/test/test.ts +++ b/examples/experimental/test/property/candid_rpc/canister_methods/pre_upgrade/test/test.ts @@ -124,7 +124,7 @@ function generateGetPreUpgradeExecutedCanisterMethod(): QueryMethod { { name: `pre upgrade was not called after first deploy`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor.getPreUpgradeExecuted(); return testEquality(result, []); @@ -135,7 +135,7 @@ function generateGetPreUpgradeExecutedCanisterMethod(): QueryMethod { { name: `pre upgrade was called after second deploy`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor.getPreUpgradeExecuted(); return testEquality(result, [true]); diff --git a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/contains_key.ts b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/contains_key.ts index b51178b4e8..825842f8fa 100644 --- a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/contains_key.ts +++ b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/contains_key.ts @@ -54,7 +54,7 @@ function generateTests( { name: `containsKey after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue @@ -68,7 +68,7 @@ function generateTests( { name: `containsKey after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue @@ -82,7 +82,7 @@ function generateTests( { name: `containsKey after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue diff --git a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/get.ts b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/get.ts index 5f8352db63..97de9539c8 100644 --- a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/get.ts +++ b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/get.ts @@ -70,7 +70,7 @@ function generateTests( { name: `get after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue @@ -86,7 +86,7 @@ function generateTests( { name: `get after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue @@ -102,7 +102,7 @@ function generateTests( { name: `get after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue diff --git a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/insert.ts b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/insert.ts index de593afbda..c712351bb6 100644 --- a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/insert.ts +++ b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/insert.ts @@ -65,7 +65,7 @@ function generateTests( { name: `insert after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue, diff --git a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/is_empty.ts b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/is_empty.ts index 91bea2690a..d571f754fd 100644 --- a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/is_empty.ts +++ b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/is_empty.ts @@ -44,7 +44,7 @@ function generateTests(functionName: string): Test[][] { { name: `isEmpty after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -56,7 +56,7 @@ function generateTests(functionName: string): Test[][] { { name: `isEmpty after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -68,7 +68,7 @@ function generateTests(functionName: string): Test[][] { { name: `isEmpty after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); diff --git a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/items.ts b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/items.ts index d2d123801a..1252d51a51 100644 --- a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/items.ts +++ b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/items.ts @@ -54,7 +54,7 @@ function generateTests( { name: `items after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -71,7 +71,7 @@ function generateTests( { name: `items after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -88,7 +88,7 @@ function generateTests( { name: `items after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); diff --git a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/keys.ts b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/keys.ts index b64008bda4..b2c942fa51 100644 --- a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/keys.ts +++ b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/keys.ts @@ -58,7 +58,7 @@ function generateTests( { name: `keys after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -77,7 +77,7 @@ function generateTests( { name: `keys after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -96,7 +96,7 @@ function generateTests( { name: `keys after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); diff --git a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/len.ts b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/len.ts index c6046ee4bb..602b28602f 100644 --- a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/len.ts +++ b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/len.ts @@ -45,7 +45,7 @@ function generateTests(functionName: string): Test[][] { { name: `len after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -57,7 +57,7 @@ function generateTests(functionName: string): Test[][] { { name: `len after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -69,7 +69,7 @@ function generateTests(functionName: string): Test[][] { { name: `len after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); diff --git a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/remove.ts b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/remove.ts index 2101a2194f..94fc4239ce 100644 --- a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/remove.ts +++ b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/remove.ts @@ -71,7 +71,7 @@ function generateTests( { name: `remove after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue diff --git a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/values.ts b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/values.ts index 05700543f1..6baac1b758 100644 --- a/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/values.ts +++ b/examples/experimental/test/property/candid_rpc/stable_b_tree_map/test/values.ts @@ -61,7 +61,7 @@ function generateTests( { name: `values after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -80,7 +80,7 @@ function generateTests( { name: `values after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -99,7 +99,7 @@ function generateTests( { name: `values after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); diff --git a/examples/stable/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_init_tests.ts b/examples/stable/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_init_tests.ts index b6c576d370..c47892e40e 100644 --- a/examples/stable/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_init_tests.ts +++ b/examples/stable/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_init_tests.ts @@ -17,7 +17,7 @@ export function generateTests( { name: `init method`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const initValues = await actor.getInitValues(); const isPostUpgradeCalled = diff --git a/examples/stable/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts b/examples/stable/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts index 7d9e9ddba4..79344d0cff 100644 --- a/examples/stable/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts +++ b/examples/stable/test/property/candid_rpc/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts @@ -18,7 +18,7 @@ export function generateTests( { name: `post upgrade method`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const postUpgradeValues = await actor.getPostUpgradeValues(); diff --git a/examples/stable/test/property/candid_rpc/canister_methods/pre_upgrade/test/test.ts b/examples/stable/test/property/candid_rpc/canister_methods/pre_upgrade/test/test.ts index 34b901f0cc..85b13b9c01 100644 --- a/examples/stable/test/property/candid_rpc/canister_methods/pre_upgrade/test/test.ts +++ b/examples/stable/test/property/candid_rpc/canister_methods/pre_upgrade/test/test.ts @@ -118,7 +118,7 @@ function generateGetPreUpgradeExecutedCanisterMethod(): QueryMethod { { name: `pre upgrade was not called after first deploy`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor.getPreUpgradeExecuted(); return testEquality(result, []); @@ -129,7 +129,7 @@ function generateGetPreUpgradeExecutedCanisterMethod(): QueryMethod { { name: `pre upgrade was called after second deploy`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor.getPreUpgradeExecuted(); return testEquality(result, [true]); diff --git a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/contains_key.ts b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/contains_key.ts index 4d221fc4c0..350ef0807a 100644 --- a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/contains_key.ts +++ b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/contains_key.ts @@ -79,7 +79,7 @@ function generateTests( { name: `containsKey after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue @@ -93,7 +93,7 @@ function generateTests( { name: `containsKey after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue @@ -107,7 +107,7 @@ function generateTests( { name: `containsKey after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue diff --git a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/get.ts b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/get.ts index b7613e01a2..47d621a627 100644 --- a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/get.ts +++ b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/get.ts @@ -79,7 +79,7 @@ function generateTests( { name: `get after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue @@ -95,7 +95,7 @@ function generateTests( { name: `get after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue @@ -111,7 +111,7 @@ function generateTests( { name: `get after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue diff --git a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/insert.ts b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/insert.ts index 8adf201b01..5f6a1f85b0 100644 --- a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/insert.ts +++ b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/insert.ts @@ -70,7 +70,7 @@ function generateTests( { name: `insert after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue, diff --git a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/is_empty.ts b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/is_empty.ts index ecd8b33e32..6fce5bb0ce 100644 --- a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/is_empty.ts +++ b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/is_empty.ts @@ -45,7 +45,7 @@ function generateTests(functionName: string): Test[][] { { name: `isEmpty after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -57,7 +57,7 @@ function generateTests(functionName: string): Test[][] { { name: `isEmpty after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -69,7 +69,7 @@ function generateTests(functionName: string): Test[][] { { name: `isEmpty after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); diff --git a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/items.ts b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/items.ts index 02d8d82f9a..60710e7e7c 100644 --- a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/items.ts +++ b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/items.ts @@ -55,7 +55,7 @@ function generateTests( { name: `items after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -72,7 +72,7 @@ function generateTests( { name: `items after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -89,7 +89,7 @@ function generateTests( { name: `items after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); diff --git a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/keys.ts b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/keys.ts index f3a09dc853..8d376e16ca 100644 --- a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/keys.ts +++ b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/keys.ts @@ -67,7 +67,7 @@ function generateTests( { name: `keys after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -86,7 +86,7 @@ function generateTests( { name: `keys after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -105,7 +105,7 @@ function generateTests( { name: `keys after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); diff --git a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/len.ts b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/len.ts index 4deaa182b0..f2cb701e4e 100644 --- a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/len.ts +++ b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/len.ts @@ -47,7 +47,7 @@ function generateTests(functionName: string): Test[][] { { name: `len after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -59,7 +59,7 @@ function generateTests(functionName: string): Test[][] { { name: `len after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -71,7 +71,7 @@ function generateTests(functionName: string): Test[][] { { name: `len after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); diff --git a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/remove.ts b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/remove.ts index 78958f8cba..cfc15e5beb 100644 --- a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/remove.ts +++ b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/remove.ts @@ -79,7 +79,7 @@ function generateTests( { name: `remove after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]( keySampleAgentArgumentValue diff --git a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/values.ts b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/values.ts index ebdf3d3ab5..2784a878d4 100644 --- a/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/values.ts +++ b/examples/stable/test/property/candid_rpc/stable_b_tree_map/test/values.ts @@ -70,7 +70,7 @@ function generateTests( { name: `values after first deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -89,7 +89,7 @@ function generateTests( { name: `values after second deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName](); @@ -108,7 +108,7 @@ function generateTests( { name: `values after third deploy ${functionName}`, test: async (): Promise => { - const actor = getActor(__dirname); + const actor = await getActor(__dirname); const result = await actor[functionName]();