From a341f5c776035ca24b1323b4a37f5f166cdc55d7 Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Fri, 22 Jul 2022 15:23:44 -0400 Subject: [PATCH] fix: Add no-op tests (#99) Add no-op tests Signed-off-by: Todd Baert --- test/no-op.spec.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/no-op.spec.ts diff --git a/test/no-op.spec.ts b/test/no-op.spec.ts new file mode 100644 index 000000000..fb85cbe51 --- /dev/null +++ b/test/no-op.spec.ts @@ -0,0 +1,25 @@ +import { OpenFeatureClient } from '../src/client.js'; +import { OpenFeature } from '../src/open-feature.js'; + +const BOOLEAN_VALUE = true; +const STRING_VALUE = 'val'; +const NUMBER_VALUE = 2034; +const OBJECT_VALUE = { + key: 'value', +}; + +const NO_OP_FLAG = 'no-op-flag'; + +describe(OpenFeatureClient.name, () => { + describe('No-op behavior', () => { + // create a no-op client. + const client = OpenFeature.getClient(); + + it('should default all evaluations', async () => { + await expect(client.getBooleanValue(NO_OP_FLAG, BOOLEAN_VALUE)).resolves.toEqual(BOOLEAN_VALUE); + await expect(client.getStringValue(NO_OP_FLAG, STRING_VALUE)).resolves.toEqual(STRING_VALUE); + await expect(client.getNumberValue(NO_OP_FLAG, NUMBER_VALUE)).resolves.toEqual(NUMBER_VALUE); + await expect(client.getObjectValue(NO_OP_FLAG, OBJECT_VALUE)).resolves.toEqual(OBJECT_VALUE); + }); + }); +});