diff --git a/property_tests/arbitraries/candid/constructed/opt_arb.ts b/property_tests/arbitraries/candid/constructed/opt_arb.ts index 6baa4c167e..0583ece971 100644 --- a/property_tests/arbitraries/candid/constructed/opt_arb.ts +++ b/property_tests/arbitraries/candid/constructed/opt_arb.ts @@ -1,12 +1,12 @@ import fc from 'fast-check'; import { Candid, CandidType, CandidTypeArb } from '../../candid'; -type InnerOptArb = ['Some' | 'None', Candid]; +type BaseOpt = ['Some' | 'None', Candid]; // This gives us a random Some or None, which means the default depth of all Opts is at least one -const InnerOptArb = (arb: fc.Arbitrary>) => { +const BaseOptArb = (arb: fc.Arbitrary>) => { return fc.constantFrom('Some', 'None').chain((keySample) => { - return arb.map((innerValueSample): InnerOptArb => { + return arb.map((innerValueSample): BaseOpt => { if (keySample === 'Some') { return ['Some', innerValueSample]; } else { @@ -18,7 +18,7 @@ const InnerOptArb = (arb: fc.Arbitrary>) => { // TODO look into making this recursive // TODO we need to add all constructed and reference types -export const PrimitiveOptArb = InnerOptArb(CandidTypeArb); +export const PrimitiveOptArb = BaseOptArb(CandidTypeArb); type RecursiveOpt = { base: T; @@ -33,7 +33,7 @@ export const OptArb = fc base: PrimitiveOptArb, nextLayer: fc .option(tie('RecursiveOptArb'), { maxDepth: 10 }) - .map((sample) => sample as RecursiveOpt) + .map((sample) => sample as RecursiveOpt) }) })) .RecursiveOptArb.map((recursiveOptArb): Candid => { @@ -48,7 +48,7 @@ export const OptArb = fc }; }); -function generateCandidType(recursiveOpt: RecursiveOpt): string { +function generateCandidType(recursiveOpt: RecursiveOpt): string { if (recursiveOpt.nextLayer === null) { // base case return `Opt(${recursiveOpt.base[1].src.candidType})`; @@ -57,7 +57,7 @@ function generateCandidType(recursiveOpt: RecursiveOpt): string { } } -function generateImports(recursiveOpt: RecursiveOpt): Set { +function generateImports(recursiveOpt: RecursiveOpt): Set { if (recursiveOpt.nextLayer === null) { // base case return new Set([...recursiveOpt.base[1].src.imports, 'Opt']); @@ -66,7 +66,7 @@ function generateImports(recursiveOpt: RecursiveOpt): Set { } } -function generateValue(recursiveOpt: RecursiveOpt): Opt { +function generateValue(recursiveOpt: RecursiveOpt): Opt { if (recursiveOpt.nextLayer === null) { // base case if (recursiveOpt.base[0] === 'Some') { @@ -79,7 +79,7 @@ function generateValue(recursiveOpt: RecursiveOpt): Opt { } } -function generateValueLiteral(recursiveOpt: RecursiveOpt): string { +function generateValueLiteral(recursiveOpt: RecursiveOpt): string { if (recursiveOpt.nextLayer === null) { // base case if (recursiveOpt.base[0] === 'Some') { @@ -118,7 +118,7 @@ function calculateDepthAndValues(value: [any] | []): { } function getBaseEquals( - recursiveOpt: RecursiveOpt + recursiveOpt: RecursiveOpt ): (a: any, b: any) => boolean { if (recursiveOpt.nextLayer === null) { // base case diff --git a/property_tests/index.ts b/property_tests/index.ts index e7dcc11251..cbbc45deb8 100644 --- a/property_tests/index.ts +++ b/property_tests/index.ts @@ -34,7 +34,7 @@ export function runPropTests(testArb: fc.Arbitrary) { return await runTests( canister.tests, - process.env.AZLE_PROPTEST_VERBOSE === undefined + process.env.AZLE_PROPTEST_VERBOSE !== 'true' ); }), {