Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions libs/providers/flagd/src/e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export const UNSTABLE_CLIENT_NAME = 'unstable';
export const UNAVAILABLE_CLIENT_NAME = 'unavailable';

export const GHERKIN_FLAGD = getGherkinTestPath('*.feature');
export const CONFIG_FEATURE = getGherkinTestPath('config.feature');
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ export const configSteps: Steps = (state: State) => {
}

return ({ given, when, then }: StepsDefinitionCallbackOptions) => {
const originalEnv = process.env;
beforeEach(() => {
state.options = {};
state.config = undefined;
state.events = [];
process.env = { ...originalEnv };
});

afterEach(() => {
process.env = originalEnv;
});
given(/^an option "(.*)" of type "(.*)" with value "(.*)"$/, (name: string, type: string, value: string) => {
state.options[mapName(name)] = mapValueToType(value, type);
Expand Down
23 changes: 23 additions & 0 deletions libs/providers/flagd/src/e2e/tests/config.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { configSteps } from '../step-definitions/configSteps';
import type { State } from '../step-definitions/state';
import { autoBindSteps, loadFeatures } from 'jest-cucumber';
import { CONFIG_FEATURE } from '../constants';

jest.setTimeout(50000);
describe('config', () => {
const state: State = {
resolverType: 'in-process',
options: {},
config: undefined,
events: [],
};
autoBindSteps(
loadFeatures(CONFIG_FEATURE, {
scenarioNameTemplate: (vars) => {
const tags = [...vars.scenarioTags, ...vars.featureTags];
return `${vars.scenarioTitle}${tags.length > 0 ? ` (${tags.join(', ')})` : ''}`;
},
}),
[configSteps(state)],
);
});