Skip to content

Commit

Permalink
refactor: short circuit response type checking in test
Browse files Browse the repository at this point in the history
  • Loading branch information
malandis committed Oct 12, 2024
1 parent aaa8cbb commit f2ab706
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/common-integration-tests/src/cache/replica-reads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit f2ab706

Please sign in to comment.