forked from open-feature/js-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add no-op tests (open-feature#99)
Add no-op tests Signed-off-by: Todd Baert <[email protected]>
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}); | ||
}); |