Skip to content

Commit

Permalink
Cucumber working for broken-out testing module
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed Nov 29, 2023
1 parent 1e89816 commit 244bfdc
Show file tree
Hide file tree
Showing 80 changed files with 5,582 additions and 434 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.pnp.*
.DS_Store
packages/.DS_Store
target/
2,709 changes: 2,592 additions & 117 deletions .pnp.cjs

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
"workspaces": [
"packages/*"
],
"packageManager": "[email protected]",
"devDependencies": {
"@types/eslint": "^8",
"eslint": "^8.53.0",
"typescript": "^5.2.2"
}
"scripts": {
"test": "yarn workspaces foreach --all test"
},
"packageManager": "[email protected]"
}
Binary file modified packages/.DS_Store
Binary file not shown.
7 changes: 0 additions & 7 deletions packages/desktop-agent/.yarnrc.yml

This file was deleted.

5 changes: 0 additions & 5 deletions packages/desktop-agent/cucumber.yml

This file was deleted.

25 changes: 0 additions & 25 deletions packages/desktop-agent/package.json

This file was deleted.

10 changes: 0 additions & 10 deletions packages/desktop-agent/test/features/channels.feature

This file was deleted.

28 changes: 0 additions & 28 deletions packages/desktop-agent/test/step-definitions/channels.steps.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/desktop-agent/test/support/DefaultUserChannels.ts

This file was deleted.

53 changes: 0 additions & 53 deletions packages/desktop-agent/test/support/TestMessaging.ts

This file was deleted.

35 changes: 0 additions & 35 deletions packages/desktop-agent/tsconfig.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 0 additions & 50 deletions packages/web-fdc3-desktop-agent-tests/cucumber-report.html

This file was deleted.

5 changes: 2 additions & 3 deletions packages/web-fdc3-desktop-agent-tests/cucumber.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
default:
format: [ "html:cucumber-report.html" ]
format: [ "html:target/cucumber-report.html" ]
paths: [ "test/features/*.feature" ]
requireModule: [ "ts-node/register" ]
require: [ "test/step-definitions/*.ts", "test/support/*.ts" ]
require: [ "target/step-definitions/*.js", "target/test/support/*.js" ]
2 changes: 1 addition & 1 deletion packages/web-fdc3-desktop-agent-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"build": "tsc",
"test": "yarn cucumber-js"
"test": "tsc; yarn cucumber-js"
},
"devDependencies": {
"@cucumber/cucumber": "10.0.1",
Expand Down
21 changes: 10 additions & 11 deletions packages/web-fdc3-desktop-agent-tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"extends": "../../tsconfig.json",
"ts-node" : {
"compilerOptions": {
"noEmit": false,
"outDir": "target",
"module": "CommonJS",
"moduleResolution": "NodeNext",
"resolveJsonModule": false,
"rootDirs": [ "test" , "src" ]
}
}
"compilerOptions": {
"outDir": "target",
"noEmit": false,
"module": "NodeNext",
"target": "ES5",
//"moduleResolution": "",
"resolveJsonModule": false,
"allowImportingTsExtensions": false
},
"include": [ "test" ],
}
File renamed without changes.
96 changes: 96 additions & 0 deletions packages/web-fdc3-desktop-agent/old/AbstractDesktopAgentOld.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractDesktopAgent = void 0;
var fdc3_1 = require("@finos/fdc3");
var BroadcastListener = /** @class */ (function () {
function BroadcastListener(type, handler) {
this.type = type;
this.handler = handler;
}
BroadcastListener.prototype.unsubscribe = function () {
// does nothing yet.
};
BroadcastListener.prototype.handle = function (ctx, metadata) {
if ((this.type == null) || (this.type == ctx.type)) {
this.handler(ctx, metadata);
}
};
return BroadcastListener;
}());
/**
* Desktop Agent using DesktopAgentBridging protocol.
* As before, just implementing broadcast, addContextListener and getInfo.
* Abstract since the choice of transport is left to the implementer.
*/
var AbstractDesktopAgent = /** @class */ (function () {
function AbstractDesktopAgent(details, options) {
this.listeners = [];
this.details = details;
this.id = {
appId: this.details.appId,
instanceId: this.details.instanceId
};
this.options = options;
var img = document.createElement("img");
img.setAttribute("width", "70");
img.setAttribute("height", "70");
img.setAttribute("src", this.getIcon());
img.setAttribute("style", "position: absolute; bottom: 0px; right: 0px;");
document.body.appendChild(img);
}
AbstractDesktopAgent.prototype.getIcon = function () {
return "";
};
AbstractDesktopAgent.prototype.postInternal = function (_m) {
throw new Error("Abstract method");
};
AbstractDesktopAgent.prototype.createMeta = function () {
return {
requestUuid: crypto.randomUUID(),
timestamp: new Date(),
source: {
appId: this.id.appId,
instanceId: this.id.instanceId
}
};
};
AbstractDesktopAgent.prototype.broadcast = function (context) {
var request = {
meta: this.createMeta(),
payload: {
channelId: "MAIN",
context: context
},
type: fdc3_1.RequestMessageType.BroadcastRequest
};
this.postInternal(request);
return new Promise(function (_resolve) { return _resolve(); });
};
AbstractDesktopAgent.prototype.getInfo = function () {
var _this = this;
return new Promise(function (resolve) {
resolve({
fdc3Version: "2.0",
provider: _this.details.dummy,
appMetadata: {
appId: _this.id.appId,
instanceId: _this.id.instanceId,
},
optionalFeatures: {
OriginatingAppMetadata: true,
UserChannelMembershipAPIs: false,
}
});
});
};
AbstractDesktopAgent.prototype.addContextListener = function (contextType, handler) {
var listo = this.listeners;
return new Promise(function (resolve) {
var theListener = new BroadcastListener(contextType, handler);
listo.push(theListener);
resolve(theListener);
});
};
return AbstractDesktopAgent;
}());
exports.AbstractDesktopAgent = AbstractDesktopAgent;
Loading

0 comments on commit 244bfdc

Please sign in to comment.