From f2ab706874e84e63a2f7239c123a5e14d8b252b9 Mon Sep 17 00:00:00 2001 From: Michael Landis Date: Fri, 11 Oct 2024 17:02:58 -0700 Subject: [PATCH] refactor: short circuit response type checking in test --- .../common-integration-tests/src/cache/replica-reads.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/common-integration-tests/src/cache/replica-reads.ts b/packages/common-integration-tests/src/cache/replica-reads.ts index 37d144782..85c82c6eb 100644 --- a/packages/common-integration-tests/src/cache/replica-reads.ts +++ b/packages/common-integration-tests/src/cache/replica-reads.ts @@ -47,11 +47,9 @@ export function runReplicaReadTests( expect(getResponse).toBeInstanceOf(CacheGet.Hit); }, `expected HIT but got ${getResponse.toString()}`); - if (getResponse instanceof CacheGet.Hit) { - expectWithMessage(() => { - expect(getResponse.valueString()).toEqual(cacheValue); - }, `expected ${cacheValue} but got ${getResponse.valueString()}`); - } + expectWithMessage(() => { + expect(getResponse.value()).toEqual(cacheValue); + }, `expected ${cacheValue} but got ${getResponse.value() ?? 'undefined'}`); })(); trials.push(trialPromise); }