Skip to content

Commit

Permalink
handle the case with no params
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jan 22, 2024
1 parent 61f3733 commit fc2f17c
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions property_tests/tests/post_upgrade_method/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,28 +215,36 @@ function generateGetInitHookExecuted(): QueryMethod {
};
}

function generateIsInitCalled(
globalPostUpgradeVariableNames: string[]
): QueryMethod {
function generateIsInitCalled(globalInitVariableNames: string[]): QueryMethod {
const areAllParamsUndefined = globalInitVariableNames
.map((name) => `${name} === undefined`)
.join(' && ');
const isInitCalled =
globalInitVariableNames.length === 0
? 'initHookExecuted'
: areAllParamsUndefined;
return {
imports: new Set(['bool', 'query']),
globalDeclarations: [],
sourceCode: /*TS*/ `isInitCalled: query([], bool, () => ${globalPostUpgradeVariableNames
.map((name) => `${name} === undefined`)
.join(' && ')})`,
sourceCode: /*TS*/ `isInitCalled: query([], bool, () => ${isInitCalled})`,
tests: []
};
}

function generateIsPostUpgradeCalled(
globalPostUpgradeVariableNames: string[]
): QueryMethod {
const areAllParamsUndefined = globalPostUpgradeVariableNames
.map((name) => `${name} === undefined`)
.join(' && ');
const isPostUpgradeCalled =
globalPostUpgradeVariableNames.length === 0
? 'postUpgradeHookExecuted'
: areAllParamsUndefined;
return {
imports: new Set(['bool', 'query']),
globalDeclarations: [],
sourceCode: /*TS*/ `isPostUpgradeCalled: query([], bool, () => ${globalPostUpgradeVariableNames
.map((name) => `${name} === undefined`)
.join(' && ')})`,
sourceCode: /*TS*/ `isPostUpgradeCalled: query([], bool, () => ${isPostUpgradeCalled})`,
tests: []
};
}
Expand Down

0 comments on commit fc2f17c

Please sign in to comment.