From 3b45dfcd8ec00666469bf5413175aa04c91dcf3e Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 17 Jan 2024 12:01:29 -0700 Subject: [PATCH] checkpoint --- .../candid_value_and_meta_arb_generator.ts | 26 +++++++++---------- .../arbitraries/candid/recursive/index.ts | 18 ++++++------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator.ts b/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator.ts index 8a82f9a61d..216629f9b7 100644 --- a/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator.ts +++ b/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator.ts @@ -18,22 +18,22 @@ export function CandidValueAndMetaArbGenerator< ) => fc.Arbitrary, valueConstraints?: any ): fc.Arbitrary> { - return DefinitionArb.chain((candidDefinition) => - fc.tuple( + return DefinitionArb.chain((candidDefinitionAndShapes) => { + const candidDefinition = candidDefinitionAndShapes.definition; + const recursiveShape = candidDefinitionAndShapes.recursiveShapes; + return fc.tuple( fc.constant(candidDefinition), - ValueArb(candidDefinition.definition, valueConstraints) - ) - ).map( + ValueArb(candidDefinition, recursiveShape, valueConstraints) + ); + }).map( ([ { - definition: { - candidMeta: { - candidTypeAnnotation, - candidTypeObject, - runtimeCandidTypeObject, - variableAliasDeclarations, - imports - } + candidMeta: { + candidTypeAnnotation, + candidTypeObject, + runtimeCandidTypeObject, + variableAliasDeclarations, + imports } }, { agentArgumentValue, agentResponseValue, valueLiteral } diff --git a/property_tests/arbitraries/candid/recursive/index.ts b/property_tests/arbitraries/candid/recursive/index.ts index 535915ac0e..554aaa93dc 100644 --- a/property_tests/arbitraries/candid/recursive/index.ts +++ b/property_tests/arbitraries/candid/recursive/index.ts @@ -7,19 +7,19 @@ import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_gen import { complexCandidDefinitionMemo } from '../candid_definition_arb/complex_candid_definition_memo'; import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../config'; -export const recursive: { - shapes: { [key: string]: RecursiveCandidDefinition }; -} = { - shapes: {} -}; - export type Recursive = any; +export type RecursiveShapes = { [key: string]: RecursiveCandidDefinition }; export function RecursiveArb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator( - RecursiveDefinitionArb(complexCandidDefinitionMemo, [], { - depthLevel: DEFAULT_DEFINITION_MAX_DEPTH - }), + RecursiveDefinitionArb( + complexCandidDefinitionMemo, + [], + {}, + { + depthLevel: DEFAULT_DEFINITION_MAX_DEPTH + } + ), RecursiveValuesArb ); }