diff --git a/property_tests/arbitraries/canister_arb.ts b/property_tests/arbitraries/canister_arb.ts index 7ee30cffca..08d72c1e6b 100644 --- a/property_tests/arbitraries/canister_arb.ts +++ b/property_tests/arbitraries/canister_arb.ts @@ -169,10 +169,6 @@ function generateSourceCode( `; } -function escapeCandidStringForBash(input: string) { - return `"${escapeForBash(input.slice(1, -1))}"`; -} - function escapeForBash(input: string) { return input .replace(/\\/g, '\\\\') // Escape backslashes diff --git a/property_tests/tests/canister_methods/pre_upgrade/test/test.ts b/property_tests/tests/canister_methods/pre_upgrade/test/test.ts index 38506f73d6..34e7945e41 100644 --- a/property_tests/tests/canister_methods/pre_upgrade/test/test.ts +++ b/property_tests/tests/canister_methods/pre_upgrade/test/test.ts @@ -1,7 +1,7 @@ import fc from 'fast-check'; import { deepEqual, getActor, runPropTests } from 'azle/property_tests'; -import { CandidValueAndMetaArbWithoutFuncs as CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; +import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CandidReturnTypeArb } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { @@ -83,10 +83,10 @@ runPropTests(CanisterArb(CanisterConfigArb)); function generateGetPreUpgradeExecutedCanisterMethod(): QueryMethod { return { - imports: new Set(['bool', 'query', 'StableBTreeMap', 'text']), + imports: new Set(['bool', 'query', 'StableBTreeMap', 'text', 'Opt']), globalDeclarations: [], - sourceCode: /*TS*/ `getPreUpgradeExecuted: query([], bool,() => { - return stable.get(PRE_UPGRADE_HOOK_EXECUTED).Some === true + sourceCode: /*TS*/ `getPreUpgradeExecuted: query([], Opt(bool),() => { + return stable.get(PRE_UPGRADE_HOOK_EXECUTED) })`, tests: [ [ @@ -96,7 +96,7 @@ function generateGetPreUpgradeExecutedCanisterMethod(): QueryMethod { const actor = getActor(__dirname); const result = await actor.getPreUpgradeExecuted(); - return { Ok: deepEqual(result, false) }; + return { Ok: deepEqual(result, []) }; } } ], @@ -107,7 +107,7 @@ function generateGetPreUpgradeExecutedCanisterMethod(): QueryMethod { const actor = getActor(__dirname); const result = await actor.getPreUpgradeExecuted(); - return { Ok: deepEqual(result, false) }; + return { Ok: deepEqual(result, [true]) }; } } ]