diff --git a/property_tests/tests/blob/test/generate_tests.ts b/property_tests/tests/blob/test/generate_tests.ts index 4b01823c76..c17cc88366 100644 --- a/property_tests/tests/blob/test/generate_tests.ts +++ b/property_tests/tests/blob/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, paramBlobs: Named>[], returnBlob: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = Uint8Array.from( paramBlobs .map((blob) => blob.el.agentResponseValue) @@ -19,19 +19,21 @@ export function generateTests( ); return [ - { - name: `blob ${functionName}`, - test: async () => { - const actor = getActor('./tests/blob/test'); + [ + { + name: `blob ${functionName}`, + test: async () => { + const actor = getActor('./tests/blob/test'); - const result = await actor[functionName]( - ...paramBlobs.map((blob) => blob.el.agentArgumentValue) - ); + const result = await actor[functionName]( + ...paramBlobs.map((blob) => blob.el.agentArgumentValue) + ); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/bool/test/generate_tests.ts b/property_tests/tests/bool/test/generate_tests.ts index 06fade587b..7c177ceed9 100644 --- a/property_tests/tests/bool/test/generate_tests.ts +++ b/property_tests/tests/bool/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamBools: Named>[], returnBool: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = namedParamBools.reduce( (acc, param) => acc && param.el.agentResponseValue, returnBool.agentResponseValue @@ -18,17 +18,19 @@ export function generateTests( ); return [ - { - name: `bool ${functionName}`, - test: async () => { - const actor = getActor('./tests/bool/test'); + [ + { + name: `bool ${functionName}`, + test: async () => { + const actor = getActor('./tests/bool/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/float32/test/generate_tests.ts b/property_tests/tests/float32/test/generate_tests.ts index e2e891e2b7..039658f13e 100644 --- a/property_tests/tests/float32/test/generate_tests.ts +++ b/property_tests/tests/float32/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamFloat32s: Named>[], returnFloat32: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = namedParamFloat32s.length === 0 ? returnFloat32.agentResponseValue @@ -17,17 +17,19 @@ export function generateTests( (paramFloats) => paramFloats.el.agentArgumentValue ); return [ - { - name: `float32 ${functionName}`, - test: async () => { - const actor = getActor('./tests/float32/test'); + [ + { + name: `float32 ${functionName}`, + test: async () => { + const actor = getActor('./tests/float32/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/float64/test/generate_tests.ts b/property_tests/tests/float64/test/generate_tests.ts index 9f1429ac9e..082d6ffa97 100644 --- a/property_tests/tests/float64/test/generate_tests.ts +++ b/property_tests/tests/float64/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamFloat64s: Named>[], returnFloat64: CandidValueAndMeta -): Test[] { +): Test[][] { const count = namedParamFloat64s.length + 1; const expectedResult = namedParamFloat64s.reduce( @@ -21,17 +21,19 @@ export function generateTests( ); return [ - { - name: `float64 ${functionName}`, - test: async () => { - const actor = getActor('./tests/float64/test'); + [ + { + name: `float64 ${functionName}`, + test: async () => { + const actor = getActor('./tests/float64/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/func/test/generate_tests.ts b/property_tests/tests/func/test/generate_tests.ts index ee6e49c55f..78ee387a4f 100644 --- a/property_tests/tests/func/test/generate_tests.ts +++ b/property_tests/tests/func/test/generate_tests.ts @@ -9,23 +9,25 @@ export function generateTests( functionName: string, namedParamFuncs: Named>[], returnFunc: CandidValueAndMeta -): Test[] { +): Test[][] { return [ - { - name: `func ${functionName}`, - test: async () => { - const actor = getActor('./tests/func/test'); + [ + { + name: `func ${functionName}`, + test: async () => { + const actor = getActor('./tests/func/test'); - const result = await actor[functionName]( - ...namedParamFuncs.map( - (param) => param.el.agentArgumentValue - ) - ); + const result = await actor[functionName]( + ...namedParamFuncs.map( + (param) => param.el.agentArgumentValue + ) + ); - return { - Ok: deepEqual(result, returnFunc.agentResponseValue) - }; + return { + Ok: deepEqual(result, returnFunc.agentResponseValue) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/int/test/generate_tests.ts b/property_tests/tests/int/test/generate_tests.ts index 1b01b2a30b..9130aa7e56 100644 --- a/property_tests/tests/int/test/generate_tests.ts +++ b/property_tests/tests/int/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamInts: Named>[], returnInt: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = namedParamInts.reduce( (acc, param) => acc + param.el.agentResponseValue, returnInt.agentResponseValue @@ -18,17 +18,19 @@ export function generateTests( ); return [ - { - name: `int ${functionName}`, - test: async () => { - const actor = getActor('./tests/int/test'); + [ + { + name: `int ${functionName}`, + test: async () => { + const actor = getActor('./tests/int/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/int16/test/generate_tests.ts b/property_tests/tests/int16/test/generate_tests.ts index 1372b4352e..7200340249 100644 --- a/property_tests/tests/int16/test/generate_tests.ts +++ b/property_tests/tests/int16/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamInt16s: Named>[], returnInt16: CandidValueAndMeta -): Test[] { +): Test[][] { const count = namedParamInt16s.length + 1; const expectedResult = Math.floor( namedParamInt16s.reduce( @@ -21,17 +21,19 @@ export function generateTests( ); return [ - { - name: `int16 ${functionName}`, - test: async () => { - const actor = getActor('./tests/int16/test'); + [ + { + name: `int16 ${functionName}`, + test: async () => { + const actor = getActor('./tests/int16/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/int32/test/generate_tests.ts b/property_tests/tests/int32/test/generate_tests.ts index 748ebae928..873d51b758 100644 --- a/property_tests/tests/int32/test/generate_tests.ts +++ b/property_tests/tests/int32/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamInt32s: Named>[], returnInt32: CandidValueAndMeta -): Test[] { +): Test[][] { const count = namedParamInt32s.length + 1; const expectedResult = Math.floor( namedParamInt32s.reduce( @@ -21,17 +21,19 @@ export function generateTests( ); return [ - { - name: `int32 ${functionName}`, - test: async () => { - const actor = getActor('./tests/int32/test'); + [ + { + name: `int32 ${functionName}`, + test: async () => { + const actor = getActor('./tests/int32/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/int64/test/generate_tests.ts b/property_tests/tests/int64/test/generate_tests.ts index 958bd40c94..f5c4e8cd91 100644 --- a/property_tests/tests/int64/test/generate_tests.ts +++ b/property_tests/tests/int64/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamInt64s: Named>[], returnInt64: CandidValueAndMeta -): Test[] { +): Test[][] { const count = namedParamInt64s.length + 1; const expectedResult = namedParamInt64s.reduce( @@ -20,17 +20,19 @@ export function generateTests( (param) => param.el.agentArgumentValue ); return [ - { - name: `int64 ${functionName}`, - test: async () => { - const actor = getActor('./tests/int64/test'); + [ + { + name: `int64 ${functionName}`, + test: async () => { + const actor = getActor('./tests/int64/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/int8/test/generate_tests.ts b/property_tests/tests/int8/test/generate_tests.ts index 43f5c8fc3b..6b7a31f4c3 100644 --- a/property_tests/tests/int8/test/generate_tests.ts +++ b/property_tests/tests/int8/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamInt8s: Named>[], returnInt8: CandidValueAndMeta -): Test[] { +): Test[][] { const count = namedParamInt8s.length + 1; const expectedResult = Math.floor( namedParamInt8s.reduce( @@ -20,17 +20,19 @@ export function generateTests( (param) => param.el.agentArgumentValue ); return [ - { - name: `test ${functionName}`, - test: async () => { - const actor = getActor('./tests/int8/test'); + [ + { + name: `test ${functionName}`, + test: async () => { + const actor = getActor('./tests/int8/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/nat/test/generate_tests.ts b/property_tests/tests/nat/test/generate_tests.ts index 31a0047d76..7861644296 100644 --- a/property_tests/tests/nat/test/generate_tests.ts +++ b/property_tests/tests/nat/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamNats: Named>[], returnNat: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = namedParamNats.reduce( (acc, param) => acc + param.el.agentResponseValue, returnNat.agentResponseValue @@ -18,17 +18,19 @@ export function generateTests( ); return [ - { - name: `nat ${functionName}`, - test: async () => { - const actor = getActor('./tests/nat/test'); + [ + { + name: `nat ${functionName}`, + test: async () => { + const actor = getActor('./tests/nat/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/nat16/test/generate_tests.ts b/property_tests/tests/nat16/test/generate_tests.ts index 6adc8ebffe..2202e87b8a 100644 --- a/property_tests/tests/nat16/test/generate_tests.ts +++ b/property_tests/tests/nat16/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamNat16s: Named>[], returnNat16: CandidValueAndMeta -): Test[] { +): Test[][] { const count = namedParamNat16s.length + 1; const expectedResult = Math.floor( namedParamNat16s.reduce( @@ -21,17 +21,19 @@ export function generateTests( ); return [ - { - name: `nat16 ${functionName}`, - test: async () => { - const actor = getActor('./tests/nat16/test'); + [ + { + name: `nat16 ${functionName}`, + test: async () => { + const actor = getActor('./tests/nat16/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/nat32/test/generate_tests.ts b/property_tests/tests/nat32/test/generate_tests.ts index c1f484d48c..6fad821fb8 100644 --- a/property_tests/tests/nat32/test/generate_tests.ts +++ b/property_tests/tests/nat32/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamNat32s: Named>[], returnNat32: CandidValueAndMeta -): Test[] { +): Test[][] { const count = namedParamNat32s.length + 1; const expectedResult = Math.floor( namedParamNat32s.reduce( @@ -21,17 +21,19 @@ export function generateTests( ); return [ - { - name: `nat32 ${functionName}`, - test: async () => { - const actor = getActor('./tests/nat32/test'); + [ + { + name: `nat32 ${functionName}`, + test: async () => { + const actor = getActor('./tests/nat32/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/nat64/test/generate_tests.ts b/property_tests/tests/nat64/test/generate_tests.ts index e6cb87ca50..6d6f1294b6 100644 --- a/property_tests/tests/nat64/test/generate_tests.ts +++ b/property_tests/tests/nat64/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamNat64s: Named>[], returnNat64: CandidValueAndMeta -): Test[] { +): Test[][] { const count = namedParamNat64s.length + 1; const expectedResult = namedParamNat64s.reduce( @@ -20,17 +20,19 @@ export function generateTests( ); return [ - { - name: `nat64 ${functionName}`, - test: async () => { - const actor = getActor('./tests/nat64/test'); + [ + { + name: `nat64 ${functionName}`, + test: async () => { + const actor = getActor('./tests/nat64/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/nat8/test/generate_tests.ts b/property_tests/tests/nat8/test/generate_tests.ts index 60f29c0a2e..c354d973a3 100644 --- a/property_tests/tests/nat8/test/generate_tests.ts +++ b/property_tests/tests/nat8/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamNat8s: Named>[], returnNat8: CandidValueAndMeta -): Test[] { +): Test[][] { const count = namedParamNat8s.length + 1; const expectedResult = Math.floor( namedParamNat8s.reduce( @@ -21,17 +21,19 @@ export function generateTests( ); return [ - { - name: `nat8 ${functionName}`, - test: async () => { - const actor = getActor('./tests/nat8/test'); + [ + { + name: `nat8 ${functionName}`, + test: async () => { + const actor = getActor('./tests/nat8/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/null/test/generate_tests.ts b/property_tests/tests/null/test/generate_tests.ts index 0c19d354d3..1d920da949 100644 --- a/property_tests/tests/null/test/generate_tests.ts +++ b/property_tests/tests/null/test/generate_tests.ts @@ -8,23 +8,25 @@ export function generateTests( functionName: string, namedParamNulls: Named>[], _returnNull: CandidValueAndMeta -): Test[] { +): Test[][] { return [ - { - name: `test ${functionName}`, - test: async () => { - const actor = getActor('./tests/null/test'); + [ + { + name: `test ${functionName}`, + test: async () => { + const actor = getActor('./tests/null/test'); - const result = await actor[functionName]( - ...namedParamNulls.map( - (param) => param.el.agentArgumentValue - ) - ); + const result = await actor[functionName]( + ...namedParamNulls.map( + (param) => param.el.agentArgumentValue + ) + ); - return { - Ok: deepEqual(result, null) - }; + return { + Ok: deepEqual(result, null) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/opt/test/generate_tests.ts b/property_tests/tests/opt/test/generate_tests.ts index 772d58eca0..3ec3692e6f 100644 --- a/property_tests/tests/opt/test/generate_tests.ts +++ b/property_tests/tests/opt/test/generate_tests.ts @@ -9,25 +9,27 @@ export function generateTests( functionName: string, namedParamOpts: Named>[], returnOpt: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = returnOpt.agentResponseValue; return [ - { - name: `opt ${functionName}`, - test: async () => { - const actor = getActor('./tests/opt/test'); + [ + { + name: `opt ${functionName}`, + test: async () => { + const actor = getActor('./tests/opt/test'); - const params = namedParamOpts.map( - (param) => param.el.agentArgumentValue - ); + const params = namedParamOpts.map( + (param) => param.el.agentArgumentValue + ); - const result = await actor[functionName](...params); + const result = await actor[functionName](...params); - return { - Ok: deepEqual(expectedResult, result) - }; + return { + Ok: deepEqual(expectedResult, result) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/principal/test/generate_tests.ts b/property_tests/tests/principal/test/generate_tests.ts index 5433012364..2e80abbfd0 100644 --- a/property_tests/tests/principal/test/generate_tests.ts +++ b/property_tests/tests/principal/test/generate_tests.ts @@ -9,25 +9,27 @@ export function generateTests( functionName: string, namedParamPrincipals: Named>[], returnPrincipal: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = namedParamPrincipals.length > 0 ? namedParamPrincipals[0].el.agentResponseValue : returnPrincipal.agentResponseValue; return [ - { - name: `principal ${functionName}`, - test: async () => { - const actor = getActor('./tests/principal/test'); - const result = await actor[functionName]( - ...namedParamPrincipals.map( - (param) => param.el.agentArgumentValue - ) - ); + [ + { + name: `principal ${functionName}`, + test: async () => { + const actor = getActor('./tests/principal/test'); + const result = await actor[functionName]( + ...namedParamPrincipals.map( + (param) => param.el.agentArgumentValue + ) + ); - return { Ok: deepEqual(result, expectedResult) }; + return { Ok: deepEqual(result, expectedResult) }; + } } - } + ] ]; } diff --git a/property_tests/tests/query_methods/test/generate_tests.ts b/property_tests/tests/query_methods/test/generate_tests.ts index a2b0f1ccf3..62f689c9ee 100644 --- a/property_tests/tests/query_methods/test/generate_tests.ts +++ b/property_tests/tests/query_methods/test/generate_tests.ts @@ -10,24 +10,26 @@ export function generateTests( functionName: string, params: Named>[], returnType: CandidValueAndMeta -): Test[] { +): Test[][] { const paramValues = params.map((param) => param.el.agentArgumentValue); const expectedResult = returnType.agentResponseValue; return [ - { - name: `query method "${functionName}"`, - test: async () => { - const actor = getActor('./tests/query_methods/test'); - const result = await actor[functionName](...paramValues); - const valuesAreEqual = deepEqual(result, expectedResult); + [ + { + name: `query method "${functionName}"`, + test: async () => { + const actor = getActor('./tests/query_methods/test'); + const result = await actor[functionName](...paramValues); + const valuesAreEqual = deepEqual(result, expectedResult); - return valuesAreEqual - ? { Ok: true } - : { - Err: `\n Incorrect return value\n expected: ${expectedResult}\n received: ${result}` - }; + return valuesAreEqual + ? { Ok: true } + : { + Err: `\n Incorrect return value\n expected: ${expectedResult}\n received: ${result}` + }; + } } - } + ] ]; } diff --git a/property_tests/tests/record/test/generate_tests.ts b/property_tests/tests/record/test/generate_tests.ts index 803eceb80a..0e2dadfe87 100644 --- a/property_tests/tests/record/test/generate_tests.ts +++ b/property_tests/tests/record/test/generate_tests.ts @@ -9,23 +9,25 @@ export function generateTests( functionName: string, namedParamRecords: Named>[], returnRecord: CandidValueAndMeta -): Test[] { +): Test[][] { return [ - { - name: `record ${functionName}`, - test: async () => { - const actor = getActor('./tests/record/test'); + [ + { + name: `record ${functionName}`, + test: async () => { + const actor = getActor('./tests/record/test'); - const result = await actor[functionName]( - ...namedParamRecords.map( - (param) => param.el.agentArgumentValue - ) - ); + const result = await actor[functionName]( + ...namedParamRecords.map( + (param) => param.el.agentArgumentValue + ) + ); - return { - Ok: deepEqual(result, returnRecord.agentResponseValue) - }; + return { + Ok: deepEqual(result, returnRecord.agentResponseValue) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/service/test/generate_tests.ts b/property_tests/tests/service/test/generate_tests.ts index d3590a364f..38f55f4e23 100644 --- a/property_tests/tests/service/test/generate_tests.ts +++ b/property_tests/tests/service/test/generate_tests.ts @@ -9,34 +9,36 @@ export function generateTests( functionName: string, namedParamServices: Named>[], returnService: CandidValueAndMeta -): Test[] { +): Test[][] { return [ - { - name: `service ${functionName}`, - test: async () => { - // Using execSync because the JS Agent has a bug expecting services - // to be ordered by hash or something. - // See https://forum.dfinity.org/t/topic/20885/14 + [ + { + name: `service ${functionName}`, + test: async () => { + // Using execSync because the JS Agent has a bug expecting services + // to be ordered by hash or something. + // See https://forum.dfinity.org/t/topic/20885/14 - const paramsString = namedParamServices - .map( - (param) => - `service "${param.el.agentArgumentValue.toText()}"` - ) - .join(); + const paramsString = namedParamServices + .map( + (param) => + `service "${param.el.agentArgumentValue.toText()}"` + ) + .join(); - const result = execSync( - `dfx canister call canister ${functionName} '(${paramsString})'` - ) - .toString() - .trim(); + const result = execSync( + `dfx canister call canister ${functionName} '(${paramsString})'` + ) + .toString() + .trim(); - return { - Ok: - result === - `(service "${returnService.agentArgumentValue.toText()}")` - }; + return { + Ok: + result === + `(service "${returnService.agentArgumentValue.toText()}")` + }; + } } - } + ] ]; } diff --git a/property_tests/tests/text/test/generate_tests.ts b/property_tests/tests/text/test/generate_tests.ts index 5b603660c7..df609bfa41 100644 --- a/property_tests/tests/text/test/generate_tests.ts +++ b/property_tests/tests/text/test/generate_tests.ts @@ -8,7 +8,7 @@ export function generateTests( functionName: string, namedParamTexts: Named>[], returnTexts: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = namedParamTexts.reduce( (acc, param) => acc + param.el.agentResponseValue, returnTexts.agentResponseValue @@ -18,17 +18,19 @@ export function generateTests( ); return [ - { - name: `text ${functionName}`, - test: async () => { - const actor = getActor('./tests/text/test'); + [ + { + name: `text ${functionName}`, + test: async () => { + const actor = getActor('./tests/text/test'); - const result = await actor[functionName](...paramValues); + const result = await actor[functionName](...paramValues); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/tuple/test/generate_tests.ts b/property_tests/tests/tuple/test/generate_tests.ts index b26960de6b..a88bdb4e90 100644 --- a/property_tests/tests/tuple/test/generate_tests.ts +++ b/property_tests/tests/tuple/test/generate_tests.ts @@ -12,23 +12,25 @@ export function generateTests( functionName: string, namedParamTuples: Named>[], returnTuple: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = returnTuple.agentResponseValue; return [ - { - name: `tuple ${functionName}`, - test: async () => { - const actor = getActor('./tests/tuple/test'); + [ + { + name: `tuple ${functionName}`, + test: async () => { + const actor = getActor('./tests/tuple/test'); - const result = await actor[functionName]( - ...namedParamTuples.map( - (param) => param.el.agentArgumentValue - ) - ); + const result = await actor[functionName]( + ...namedParamTuples.map( + (param) => param.el.agentArgumentValue + ) + ); - return { Ok: deepEqual(result, expectedResult) }; + return { Ok: deepEqual(result, expectedResult) }; + } } - } + ] ]; } diff --git a/property_tests/tests/update_methods/test/generate_tests.ts b/property_tests/tests/update_methods/test/generate_tests.ts index 18f069bf60..1d64ee7e17 100644 --- a/property_tests/tests/update_methods/test/generate_tests.ts +++ b/property_tests/tests/update_methods/test/generate_tests.ts @@ -10,24 +10,26 @@ export function generateTests( functionName: string, params: Named>[], returnType: CandidValueAndMeta -): Test[] { +): Test[][] { const paramValues = params.map((param) => param.el.agentArgumentValue); const expectedResult = returnType.agentResponseValue; return [ - { - name: `update method "${functionName}"`, - test: async () => { - const actor = getActor('./tests/update_methods/test'); - const result = await actor[functionName](...paramValues); - const valuesAreEqual = deepEqual(result, expectedResult); + [ + { + name: `update method "${functionName}"`, + test: async () => { + const actor = getActor('./tests/update_methods/test'); + const result = await actor[functionName](...paramValues); + const valuesAreEqual = deepEqual(result, expectedResult); - return valuesAreEqual - ? { Ok: true } - : { - Err: `\n Incorrect return value\n expected: ${expectedResult}\n received: ${result}` - }; + return valuesAreEqual + ? { Ok: true } + : { + Err: `\n Incorrect return value\n expected: ${expectedResult}\n received: ${result}` + }; + } } - } + ] ]; } diff --git a/property_tests/tests/variant/test/generate_tests.ts b/property_tests/tests/variant/test/generate_tests.ts index 4bf5262aa4..270f08a078 100644 --- a/property_tests/tests/variant/test/generate_tests.ts +++ b/property_tests/tests/variant/test/generate_tests.ts @@ -9,25 +9,27 @@ export function generateTests( functionName: string, namedParamVariants: Named>[], returnVariant: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = returnVariant.agentResponseValue; return [ - { - name: `variant ${functionName}`, - test: async () => { - const actor = getActor('./tests/variant/test'); + [ + { + name: `variant ${functionName}`, + test: async () => { + const actor = getActor('./tests/variant/test'); - const result = await actor[functionName]( - ...namedParamVariants.map( - (param) => param.el.agentArgumentValue - ) - ); + const result = await actor[functionName]( + ...namedParamVariants.map( + (param) => param.el.agentArgumentValue + ) + ); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; } diff --git a/property_tests/tests/vec/test/generate_tests.ts b/property_tests/tests/vec/test/generate_tests.ts index 1c0e7400a4..0ba77a672d 100644 --- a/property_tests/tests/vec/test/generate_tests.ts +++ b/property_tests/tests/vec/test/generate_tests.ts @@ -8,24 +8,26 @@ export function generateTests( functionName: string, namedParamVecs: Named>[], returnVec: CandidValueAndMeta -): Test[] { +): Test[][] { const expectedResult = returnVec.agentResponseValue; return [ - { - name: `vec ${functionName}`, - test: async () => { - const actor = getActor('./tests/vec/test'); + [ + { + name: `vec ${functionName}`, + test: async () => { + const actor = getActor('./tests/vec/test'); - const params = namedParamVecs.map( - (param) => param.el.agentArgumentValue - ); - const result = await actor[functionName](...params); + const params = namedParamVecs.map( + (param) => param.el.agentArgumentValue + ); + const result = await actor[functionName](...params); - return { - Ok: deepEqual(result, expectedResult) - }; + return { + Ok: deepEqual(result, expectedResult) + }; + } } - } + ] ]; }