Skip to content

Commit

Permalink
Switched to using NPM Versions of FDC3
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed Sep 26, 2024
2 parents 501247d + fb2967a commit f977fd6
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 39 deletions.
57 changes: 28 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/test/common/fdc3.app-channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { APP_CHANNEL_AND_BROADCAST, APP_CHANNEL_AND_BROADCAST_TWICE, ChannelCont

export function createAppChannelTests(cc: ChannelControl<any, any, any>, documentation: string, prefix: string): Mocha.Suite {
return describe("App channels", () => {
beforeEach(cc.leaveChannel);
beforeEach(async () => cc.leaveChannel());

afterEach(async function afterEach() {
await cc.closeMockApp(this.currentTest.title);
Expand Down Expand Up @@ -167,7 +167,7 @@ export function createAppChannelTests(cc: ChannelControl<any, any, any>, documen
}
}
} finally {
cc.unsubscribeListeners([listener,listener2]);
cc.unsubscribeListeners([listener, listener2]);
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/test/common/fdc3.user-channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import constants from "../../constants";
export function createUserChannelTests(cc: ChannelControl<any, any, any>, documentation: string, prefix: string): Mocha.Suite {
const channelName = prefix === "" ? "System channels" : "User channels";
return describe(channelName, () => {
beforeEach(cc.leaveChannel);
beforeEach(async () => cc.leaveChannel());

afterEach(async function afterEach() {
if (this.currentTest.title !== UCFilteredUsageJoin) await cc.closeMockApp(this.currentTest.title);
Expand Down
1 change: 0 additions & 1 deletion src/test/v1.2/fdc3-1_2-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ declare let fdc3: DesktopAgent;
export async function closeMockAppWindow(testId: string) {
const appControlChannel = await fdc3.getOrCreateChannel(constants.ControlChannel);
const contextPromise = waitForContext("windowClosed", testId, appControlChannel);
await wait(300) // Added due to nested promise await race condition first observed by Jupnit.
await broadcastCloseWindow(testId);
await contextPromise;
await wait(constants.WindowCloseWaitTime); // wait for window to close
Expand Down
16 changes: 11 additions & 5 deletions src/test/v2.0/advanced/fdc3.raiseIntent-Result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default () =>
const RaiseIntentVoidResult5secs = "(2.0-RaiseIntentVoidResult5secs) App A receives a void IntentResult after a 5 second delay";
it(RaiseIntentVoidResult5secs, async () => {
errorListener = await control.listenForError();
const receiver = control.receiveContext(ControlContextType.aTestingIntentListenerTriggered, 8000);
let receiver = control.receiveContext(ControlContextType.aTestingIntentListenerTriggered, 8000);
await wait(300) // Added due to nested promise await race condition first observed by Jupnit.
const intentResolution = await control.raiseIntent(Intent.aTestingIntent, ContextType.testContextX, undefined, 5000);
control.validateIntentResolution(IntentApp.IntentAppA, intentResolution);
let intentResultPromise = control.getIntentResult(intentResolution);
Expand All @@ -56,7 +57,8 @@ export default () =>
const RaiseIntentContextResult5secs = "(2.0-RaiseIntentContextResult5secs) IntentResult resolves to testContextY instance after a 5 second delay";
it(RaiseIntentContextResult5secs, async () => {
errorListener = await control.listenForError();
const receiver = control.receiveContext(ControlContextType.sharedTestingIntent1ListenerTriggered, 8000);
let receiver = control.receiveContext(ControlContextType.sharedTestingIntent1ListenerTriggered, 8000);
await wait(300) // Added due to nested promise await race condition first observed by Jupnit.
const intentResolution = await control.raiseIntent(Intent.sharedTestingIntent1, ContextType.testContextY, undefined, 5000);
control.validateIntentResolution(IntentApp.IntentAppB, intentResolution);
const intentResultPromise = control.getIntentResult(intentResolution);
Expand All @@ -71,7 +73,8 @@ export default () =>
const RaiseIntentChannelResult = "(2.0-RaiseIntentChannelResult) IntentResult resolves to a Channel object";
it(RaiseIntentChannelResult, async () => {
errorListener = await control.listenForError();
const receiver = control.receiveContext(ControlContextType.sharedTestingIntent2ResultSent, constants.WaitTime);
let receiver = control.receiveContext(ControlContextType.sharedTestingIntent2ResultSent, constants.WaitTime);
await wait(300) // Added due to nested promise await race condition first observed by Jupnit.
const intentResolution = await control.raiseIntent(Intent.sharedTestingIntent2, ContextType.testContextY, {
appId: IntentApp.IntentAppE,
});
Expand All @@ -89,6 +92,7 @@ export default () =>
it(RaiseIntentPrivateChannelResult, async () => {
errorListener = await control.listenForError();
let receiver = control.receiveContext(ControlContextType.sharedTestingIntent2ResultSent, constants.WaitTime);
await wait(300) // Added due to nested promise await race condition first observed by Jupnit.
const intentResolution = await control.raiseIntent(Intent.sharedTestingIntent2, ContextType.testContextY, {
appId: IntentApp.IntentAppF,
});
Expand All @@ -105,7 +109,8 @@ export default () =>
const RaiseIntentVoidResult61secs = "(2.0-RaiseIntentVoidResult61secs) App A receives a void IntentResult after a 61 second delay";
it(RaiseIntentVoidResult61secs, async () => {
errorListener = await control.listenForError();
const receiver = control.receiveContext(ControlContextType.aTestingIntentListenerTriggered, 64000);
let receiver = control.receiveContext(ControlContextType.aTestingIntentListenerTriggered, 64000);
await wait(300) // Added due to nested promise await race condition first observed by Jupnit.
const intentResolution = await control.raiseIntent(Intent.aTestingIntent, ContextType.testContextX, undefined, 61000);
control.validateIntentResolution(IntentApp.IntentAppA, intentResolution);
let intentResultPromise = control.getIntentResult(intentResolution);
Expand All @@ -120,7 +125,8 @@ export default () =>
const RaiseIntentContextResult61secs = "(2.0-RaiseIntentContextResult61secs) IntentResult resolves to testContextY instance after a 61 second delay";
it(RaiseIntentContextResult61secs, async () => {
errorListener = await control.listenForError();
const receiver = control.receiveContext(ControlContextType.sharedTestingIntent1ListenerTriggered, 64000);
let receiver = control.receiveContext(ControlContextType.sharedTestingIntent1ListenerTriggered, 64000);
await wait(300) // Added due to nested promise await race condition first observed by Jupnit.
const intentResolution = await control.raiseIntent(Intent.sharedTestingIntent1, ContextType.testContextY, undefined, 61000);
control.validateIntentResolution(IntentApp.IntentAppB, intentResolution);
let intentResultPromise = control.getIntentResult(intentResolution);
Expand Down
2 changes: 1 addition & 1 deletion src/test/v2.0/fdc3-2_0-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ export const waitForContext = async (contextType: string, testId: string, channe
listenerPromise
}
})
};
};

0 comments on commit f977fd6

Please sign in to comment.