Skip to content

Commit af7956d

Browse files
committed
fixup: pr changes
Signed-off-by: Simon Schrottner <[email protected]>
1 parent f0b1dd1 commit af7956d

File tree

3 files changed

+28
-35
lines changed
  • libs
    • providers
      • flagd/src/e2e/step-definitions
      • flagd-web/src/e2e/step-definitions
    • shared/flagd-core/src/e2e

3 files changed

+28
-35
lines changed

Diff for: libs/providers/flagd-web/src/e2e/step-definitions/flag.ts

+17-19
Original file line numberDiff line numberDiff line change
@@ -255,31 +255,29 @@ export const flagStepDefinitions: StepDefinitions = ({ given, and, when, then })
255255
},
256256
);
257257

258-
let ran: Promise<boolean>;
258+
let ran: boolean;
259259
when('a PROVIDER_READY handler is added', () => {
260-
ran = new Promise<boolean>((resolve) => {
261-
client.addHandler(ProviderEvents.Ready, async () => {
262-
resolve(true);
263-
});
260+
client.addHandler(ProviderEvents.Ready, async () => {
261+
ran = true;
264262
});
265263
});
266264
then('the PROVIDER_READY handler must run', () => {
267265
expect(ran).toBeTruthy();
268266
});
269267

270268
when('a PROVIDER_CONFIGURATION_CHANGED handler is added', () => {
271-
ran = new Promise<boolean>((resolve) => {
272-
client.addHandler(ProviderEvents.ConfigurationChanged, async (details) => {
273-
// file writes are not atomic, so we get a few events in quick succession from the testbed
274-
// some will not contain changes, this tolerates that; at least 1 should have our change
275-
276-
// All Flags are changed we do not provide a list of changed flags, that is the nature of the web sdk
277-
//if (details?.flagsChanged?.length) {
278-
// flagsChanged = details?.flagsChanged;
279-
280-
resolve(true);
281-
//}
282-
});
269+
client.addHandler(ProviderEvents.ConfigurationChanged, async (details) => {
270+
// file writes are not atomic, so we get a few events in quick succession from the testbed
271+
// some will not contain changes, this tolerates that; at least 1 should have our change
272+
273+
// TODO: enable this for testing of issue
274+
//if (details?.flagsChanged?.length) {
275+
// flagsChanged = details?.flagsChanged;
276+
// ran = true;
277+
//}
278+
279+
// TODO: remove this for testing of issue
280+
ran = true;
283281
});
284282
});
285283

@@ -289,11 +287,11 @@ export const flagStepDefinitions: StepDefinitions = ({ given, and, when, then })
289287
});
290288

291289
then('the PROVIDER_CONFIGURATION_CHANGED handler must run', async () => {
292-
expect(await ran).toBeTruthy();
290+
expect(ran).toBeTruthy();
293291
});
294292

295293
and(/^the event details must indicate "(.*)" was altered$/, (flagName) => {
296-
// All Flags are changed we do not provide a list of changed flags, that is the nature of the web sdk
294+
// TODO: enable this for testing of issue
297295
//expect(flagsChanged).toContain(flagName);
298296
});
299297

Diff for: libs/providers/flagd/src/e2e/step-definitions/flag.ts

+11-15
Original file line numberDiff line numberDiff line change
@@ -284,29 +284,25 @@ export const flagStepDefinitions: StepDefinitions = ({ given, and, when, then })
284284
},
285285
);
286286

287-
let ran: Promise<boolean>;
287+
let ran: boolean;
288288
when('a PROVIDER_READY handler is added', () => {
289-
ran = new Promise<boolean>((resolve) => {
290-
client.addHandler(ProviderEvents.Ready, async () => {
291-
resolve(true);
292-
});
289+
client.addHandler(ProviderEvents.Ready, async () => {
290+
ran = true;
293291
});
294292
});
295293
then('the PROVIDER_READY handler must run', () => {
296294
expect(ran).toBeTruthy();
297295
});
298296

299297
when('a PROVIDER_CONFIGURATION_CHANGED handler is added', () => {
300-
ran = new Promise<boolean>((resolve) => {
301-
client.addHandler(ProviderEvents.ConfigurationChanged, async (details) => {
302-
// file writes are not atomic, so we get a few events in quick succession from the testbed
303-
// some will not contain changes, this tolerates that; at least 1 should have our change
304-
if (details?.flagsChanged?.length) {
305-
flagsChanged = details?.flagsChanged;
306-
307-
resolve(true);
308-
}
309-
});
298+
client.addHandler(ProviderEvents.ConfigurationChanged, async (details) => {
299+
// file writes are not atomic, so we get a few events in quick succession from the testbed
300+
// some will not contain changes, this tolerates that; at least 1 should have our change
301+
if (details?.flagsChanged?.length) {
302+
flagsChanged = details?.flagsChanged;
303+
304+
ran = true;
305+
}
310306
});
311307
});
312308

Diff for: libs/shared/flagd-core/src/e2e/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ export const E2E_CLIENT_NAME = 'e2e';
33
export const IMAGE_VERSION = 'v0.5.13';
44

55
export function getGherkinTestPath(file: string, modulePath = 'test-harness/gherkin/'): string {
6-
// TODO: find a way to resolve this in a generic manner - currently this works, because of the file structure
76
return `<rootdir>/../../../../../shared/flagd-core/${modulePath}${file}`;
87
}

0 commit comments

Comments
 (0)