diff --git a/property_tests/arbitraries/candid/constructed/blob_arb.ts b/property_tests/arbitraries/candid/constructed/blob_arb.ts index 6090071e99..bee4bcd2d8 100644 --- a/property_tests/arbitraries/candid/constructed/blob_arb.ts +++ b/property_tests/arbitraries/candid/constructed/blob_arb.ts @@ -1,5 +1,5 @@ import fc from 'fast-check'; -import { CandidMetaArb } from '../candid_arb'; +import { CandidMeta, CandidMetaArb } from '../candid_arb'; import { blobToSrcLiteral } from '../to_src_literal/blob'; export const BlobArb = fc @@ -7,7 +7,9 @@ export const BlobArb = fc CandidMetaArb(fc.uint8Array(), 'Vec(nat8)', blobToSrcLiteral), CandidMetaArb(fc.uint8Array(), 'blob', blobToSrcLiteral) ) - .map((sample) => ({ - ...sample, - src: { ...sample.src, imports: new Set(['blob', 'nat8', 'Vec']) } - })); + .map( + (sample): CandidMeta => ({ + ...sample, + src: { ...sample.src, imports: new Set(['blob', 'nat8', 'Vec']) } + }) + ); diff --git a/property_tests/arbitraries/candid/constructed/tuple_arb/base.ts b/property_tests/arbitraries/candid/constructed/tuple_arb/base.ts index a1af33377c..504da6b963 100644 --- a/property_tests/arbitraries/candid/constructed/tuple_arb/base.ts +++ b/property_tests/arbitraries/candid/constructed/tuple_arb/base.ts @@ -33,7 +33,7 @@ export function TupleArb(candidTypeArb: fc.Arbitrary>) { const agentArgumentValue = generateVale(fields); - const agentResponseValue = generateExpectedVale(fields); + const agentResponseValue = generateExpectedValue(fields); return { src: { @@ -53,7 +53,7 @@ function generateVale(fields: CandidMeta[]) { return fields.map((field) => field.agentArgumentValue); } -function generateExpectedVale(fields: CandidMeta[]): Tuple | {} { +function generateExpectedValue(fields: CandidMeta[]): ReturnTuple { if (fields.length === 0) { return {}; } diff --git a/property_tests/arbitraries/query_method_arb.ts b/property_tests/arbitraries/query_method_arb.ts index c95c52f548..9ee7931733 100644 --- a/property_tests/arbitraries/query_method_arb.ts +++ b/property_tests/arbitraries/query_method_arb.ts @@ -18,30 +18,46 @@ export type QueryMethod = { export type BodyGenerator< ParamType extends CandidType, - ReturnType extends CandidType + ParamAgentType, + ReturnType extends CandidType, + ReturnAgentType > = ( - namedParams: Named>[], - returnType: CandidMeta + namedParams: Named>[], + returnType: CandidMeta ) => string; export type TestsGenerator< ParamType extends CandidType, - ReturnType extends CandidType + ParamAgentType, + ReturnType extends CandidType, + ReturnAgentType > = ( methodName: string, - namedParams: Named>[], - returnType: CandidMeta + namedParams: Named>[], + returnType: CandidMeta ) => Test[]; export function QueryMethodArb< ParamType extends CandidType, - ReturnType extends CandidType + ParamAgentType, + ReturnType extends CandidType, + ReturnAgentType >( - paramTypeArrayArb: fc.Arbitrary[]>, - returnTypeArb: fc.Arbitrary>, + paramTypeArrayArb: fc.Arbitrary[]>, + returnTypeArb: fc.Arbitrary>, constraints: { - generateBody: BodyGenerator; - generateTests: TestsGenerator; + generateBody: BodyGenerator< + ParamType, + ParamAgentType, + ReturnType, + ReturnAgentType + >; + generateTests: TestsGenerator< + ParamType, + ParamAgentType, + ReturnType, + ReturnAgentType + >; // TODO: Consider adding a callback to determine the returnType // i.e. instead of using the first one if the params array isn't empty. }