From c9717ceeb67f89d7fe7293a4e3654f4e1d271373 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Mon, 14 Oct 2024 09:44:03 -0700 Subject: [PATCH] Fix client tests. --- .../sdk-client/__tests__/LDCLientImpl.inspections.test.ts | 2 ++ .../shared/sdk-client/src/evaluation/evaluationDetail.ts | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/shared/sdk-client/__tests__/LDCLientImpl.inspections.test.ts b/packages/shared/sdk-client/__tests__/LDCLientImpl.inspections.test.ts index 487299d6c..13b5f1b78 100644 --- a/packages/shared/sdk-client/__tests__/LDCLientImpl.inspections.test.ts +++ b/packages/shared/sdk-client/__tests__/LDCLientImpl.inspections.test.ts @@ -187,5 +187,7 @@ it('calls flag-details-changed inspectors when all flag values change', async () 'moonshot-demo': { reason: null, value: true, variationIndex: 0 }, test1: { reason: null, value: 's1', variationIndex: 0 }, 'this-is-a-test': { reason: null, value: true, variationIndex: 0 }, + 'has-prereq-depth-1': { reason: { kind: 'FALLTHROUGH' }, value: true, variationIndex: 0 }, + 'is-prereq': { reason: { kind: 'FALLTHROUGH' }, value: true, variationIndex: 0 }, }); }); diff --git a/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts b/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts index cb94cae82..66a5d5713 100644 --- a/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts +++ b/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts @@ -19,10 +19,13 @@ export function createSuccessEvaluationDetail( reason?: LDEvaluationReason, prerequisites?: string[], ): LDEvaluationDetail { - return { + const res: LDEvaluationDetail = { value, variationIndex: variationIndex ?? null, reason: reason ?? null, - prerequisites, }; + if (prerequisites) { + res.prerequisites = prerequisites; + } + return res; }