Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add no-op tests #99

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions test/no-op.spec.ts
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);
});
});
});