Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -16,7 +16,13 @@ export const configSteps: Steps = (state: State) => {
return ({ given, when, then }: StepsDefinitionCallbackOptions) => {
beforeEach(() => {
state.options = {};
state.config = undefined;
state.events = [];
const originalEnv = { ...process.env };
Object.keys(process.env).forEach((key) => delete process.env[key]);
Object.assign(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
22 changes: 22 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,22 @@
import { configSteps } from '../step-definitions/configSteps';
import type { State } from '../step-definitions/state';
import { autoBindSteps, loadFeatures } from 'jest-cucumber';
import { CONFIG_FEATURE } from '../constants';

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)],
);
});