Skip to content

Commit

Permalink
Update bool test
Browse files Browse the repository at this point in the history
  • Loading branch information
dansteren committed Dec 8, 2023
1 parent 12d7206 commit 9b1cc57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions property_tests/tests/bool/test/generate_body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correc

export function generateBody(
namedParamBools: Named<CandidValueAndMeta<boolean>>[],
returnBool: CandidValueAndMeta<boolean>
returnBool: CandidValueAndMeta<boolean> | undefined
): string {
// TODO do we want to encapsulate 'boolean' in the CandidArb? Like an agentType instead of a candidType, like azleValue and agentValue?
// TODO or will this not matter anymore once we start using a deep equal library
Expand All @@ -16,9 +16,12 @@ export function generateBody(

const paramsCorrectlyOrdered = areParamsCorrectlyOrdered(namedParamBools);

const returnStatement = namedParamBools.reduce((acc, { name }) => {
return `${acc} && ${name}`;
}, returnBool.src.valueLiteral);
const returnStatement = namedParamBools.reduce(
(acc, { name }) => {
return `${acc} && ${name}`;
},
returnBool?.src.valueLiteral
);

return `
${paramsAreBooleans}
Expand Down
4 changes: 2 additions & 2 deletions property_tests/tests/bool/test/generate_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { Test } from 'azle/test';
export function generateTests(
functionName: string,
namedParamBools: Named<CandidValueAndMeta<boolean>>[],
returnBool: CandidValueAndMeta<boolean>
returnBool: CandidValueAndMeta<boolean> | undefined
): Test[][] {
const expectedResult = namedParamBools.reduce(
(acc, param) => acc && param.el.agentResponseValue,
returnBool.agentResponseValue
returnBool?.agentResponseValue
);
const paramValues = namedParamBools.map(
(param) => param.el.agentArgumentValue
Expand Down

0 comments on commit 9b1cc57

Please sign in to comment.