From 22e6bdbb27d51a340fc390c6dc5ab008d2290da4 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 19 Jan 2024 15:37:47 -0700 Subject: [PATCH] quick fixes --- property_tests/arbitraries/canister_arb.ts | 4 ---- .../tests/canister_methods/pre_upgrade/test/test.ts | 12 ++++++------ 2 files changed, 6 insertions(+), 10 deletions(-) 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]) }; } } ]