Skip to content

Commit

Permalink
quick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jan 19, 2024
1 parent 00f3328 commit 02f5362
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 0 additions & 4 deletions property_tests/arbitraries/canister_arb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions property_tests/tests/canister_methods/pre_upgrade/test/test.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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: [
[
Expand All @@ -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, []) };
}
}
],
Expand All @@ -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]) };
}
}
]
Expand Down

0 comments on commit 02f5362

Please sign in to comment.