Skip to content

Commit

Permalink
Minor wip
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed May 15, 2024
1 parent 747eb4f commit 6bc18f9
Show file tree
Hide file tree
Showing 13 changed files with 1,562 additions and 3,468 deletions.
3,801 changes: 946 additions & 2,855 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"compile": "webpack build",
"replace-glue-core": "npm run copy && npx replace-in-file --configFile=options/glue-core-app-1.2.js && npx replace-in-file --configFile=options/glue-core-support-1.2.js && npx replace-in-file --configFile=options/glue-core-app-2.0.js && npx replace-in-file --configFile=options/glue-core-support-2.0.js",
"replace-glue-core-plus": "npm run copy && npx replace-in-file --configFile=options/glue-core-plus-app-2.0.js && npx replace-in-file --configFile=options/glue-core-support-2.0.js",
"copy-glue-libs" : "shx cp -R options/glue/* ./dist",
"copy-glue-libs": "shx cp -R options/glue/* ./dist",
"replace-connectifi": "npm run copy && npx replace-in-file --configFile=options/connectifi-adapter.js",
"serve": "npx http-server ./dist -p 3001 -c-1",
"start": "npm run copy && npm run compile && npm run serve",
Expand All @@ -15,6 +15,7 @@
"build-static": "npm run compile && npm run copy"
},
"dependencies": {
"@kite9/client": "^0.0.17",
"buffer": "^6.0.3",
"chai": "^4.3.6",
"fdc3_1_2": "npm:@finos/fdc3@^1.2.0",
Expand All @@ -40,4 +41,4 @@
"webpack": "^5.69.1",
"webpack-cli": "^4.9.2"
}
}
}
3 changes: 2 additions & 1 deletion src/mock/v1.2/mock-functions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DesktopAgent } from "fdc3_1_2/dist/api/DesktopAgent";
import constants from "../../constants";
import { AppControlContext } from "../../context-types";
import { fdc3Ready } from "@kite9/client";

declare let fdc3: DesktopAgent;

Expand All @@ -9,7 +10,7 @@ export const onFdc3Ready = () =>
if (window.fdc3) {
resolve(undefined);
} else {
window.addEventListener("fdc3Ready", () => resolve(undefined));
fdc3Ready().then(() => resolve(undefined))
}
});

Expand Down
5 changes: 3 additions & 2 deletions src/mock/v2.0/mock-functions.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { DesktopAgent } from "fdc3_2_0/dist/api/DesktopAgent";
import constants from "../../constants";
import { AppControlContext } from "../../context-types";
import { fdc3Ready } from '@kite9/client'

declare let fdc3: DesktopAgent;

export const onFdc3Ready = () =>
new Promise((resolve) => {
if (window.fdc3) {
resolve(undefined);
resolve(undefined)
} else {
window.addEventListener("fdc3Ready", () => resolve(undefined));
fdc3Ready().then(api => { resolve(undefined) })
}
});

Expand Down
428 changes: 214 additions & 214 deletions src/test/common/fdc3.app-channels.ts

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/test/common/fdc3.open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function getCommonOpenTests(control: OpenControl<any>, documentation: str
const AOpensB3 = `(${config.prefix}AOpensB3) Can open app B from app A with no context and ${config.targetMultiple} as config.target`;
it(AOpensB3, async () => {
let targetApp: any;
targetApp = control.createTargetApp(openApp.b.name,openApp.b.id);
targetApp = control.createTargetApp(openApp.b.name, openApp.b.id);
const result = control.contextReceiver("fdc3-conformance-opened");
await control.openMockApp(targetApp);
await result;
Expand All @@ -19,7 +19,7 @@ export function getCommonOpenTests(control: OpenControl<any>, documentation: str
it(AFailsToOpenB3, async () => {
try {
let targetApp: any;
targetApp = control.createTargetApp("ThisAppDoesNotExist","ThisAppDoesNotExist");
targetApp = control.createTargetApp("ThisAppDoesNotExist", "ThisAppDoesNotExist");
await control.openMockApp(targetApp);
assert.fail("No error was not thrown", documentation);
} catch (ex) {
Expand All @@ -31,18 +31,18 @@ export function getCommonOpenTests(control: OpenControl<any>, documentation: str
it(AOpensBWithContext3, async () => {
let context: any, targetApp: any;
context = { type: "fdc3.instrument", name: "context" };
targetApp = control.createTargetApp(openApp.b.name,openApp.b.id);
targetApp = control.createTargetApp(openApp.b.name, openApp.b.id);
const receiver = control.contextReceiver(ControlContextType.contextReceived);
await control.openMockApp(targetApp, context);
await control.validateReceivedContext(await receiver, "fdc3.instrument");
await control.closeMockApp(AOpensBWithContext3);
});

const AOpensBWithSpecificContext = `(${config.prefix}AOpensBWithSpecificContext) Can open app B from app A with context and ${config.targetMultiple} as config.target and app B is expecting context`;
it(AOpensBWithSpecificContext, async () => {
let context: any, targetApp: any;
context = { type: "fdc3.instrument", name: "context" };
targetApp = control.createTargetApp(openApp.b.name,openApp.b.id);
targetApp = control.createTargetApp(openApp.b.name, openApp.b.id);
const receiver = control.contextReceiver(ControlContextType.contextReceived);
await control.openMockApp(targetApp, context);
await control.validateReceivedContext(await receiver, "fdc3.instrument");
Expand All @@ -53,7 +53,7 @@ export function getCommonOpenTests(control: OpenControl<any>, documentation: str
it(AOpensBMultipleListen, async () => {
let context: any, targetApp: any;
context = { type: "fdc3.instrument", name: "context" };
targetApp = control.createTargetApp(openApp.b.name,openApp.b.id);
targetApp = control.createTargetApp(openApp.b.name, openApp.b.id);
const receiver = control.contextReceiver(ControlContextType.contextReceived);
await control.openMockApp(targetApp, context);
await receiver;
Expand All @@ -64,20 +64,20 @@ export function getCommonOpenTests(control: OpenControl<any>, documentation: str
const AOpensBWithWrongContext = `(${config.prefix}AOpensBWithWrongContext) Received App timeout when opening app B with fake context, app b listening for different context`;
it(AOpensBWithWrongContext, async () => {
await control.addListenerAndFailIfReceived();
let targetApp = control.createTargetApp(openApp.b.name,openApp.b.id);
let targetApp = control.createTargetApp(openApp.b.name, openApp.b.id);
let closed = false;
setTimeout(() => {
if (!closed) {
control.closeMockApp(AOpensBWithWrongContext);
closed = true;
}
}, constants.NoListenerTimeout+100);
}, constants.NoListenerTimeout + 100);

await control.expectAppTimeoutErrorOnOpen(targetApp);
if (!closed) {
control.closeMockApp(AOpensBWithWrongContext);
closed = true;
}
}).timeout(constants.NoListenerTimeout + 2000);

}
Loading

0 comments on commit 6bc18f9

Please sign in to comment.