Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

* Added basic conformance tests verifying that `DesktopAgent.addEventListener` is callable and returns a `Listener` for filtered and unfiltered event listeners. ([#1774](https://github.com/finos/FDC3/issues/1774))
* Added CI dependency checks for the root package and every npm workspace, with documented baselines of existing unused-dependency findings.
* Added conformance coverage for `ChannelError.NoChannelFound`, `ChannelError.MalformedContext`, and `ChannelError.InvalidArguments`. ([#1779](https://github.com/finos/FDC3/issues/1779))
* Added conformance coverage verifying that Desktop Agent methods continue to work when destructured from the `fdc3` object. ([#1778](https://github.com/finos/FDC3/issues/1778))
Expand Down
31 changes: 31 additions & 0 deletions toolbox/fdc3-conformance/src/test/basic/fdc3.basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,34 @@ const basicIL1 = (fdc3: DesktopAgent, documentation: string) => {
});
};

const basicAEL1 = (fdc3: DesktopAgent, documentation: string) => {
it('(BasicAEL1) addEventListener is callable and returns a Listener', async () => {
expect(fdc3.addEventListener, documentation).to.be.a('function');

try {
const listener = await fdc3.addEventListener('userChannelChanged', () => {});
expect(listener, documentation).to.be.an('object');
expect(listener, documentation).to.have.property('unsubscribe').that.is.a('function');
await listener.unsubscribe();
} catch (ex) {
handleFail(documentation, ex);
}
});
};

const basicAEL2 = (fdc3: DesktopAgent, documentation: string) => {
it('(BasicAEL2) addEventListener returns a Listener for an unfiltered listener', async () => {
try {
const listener = await fdc3.addEventListener(null, () => {});
expect(listener, documentation).to.be.an('object');
expect(listener, documentation).to.have.property('unsubscribe').that.is.a('function');
await listener.unsubscribe();
} catch (ex) {
handleFail(documentation, ex);
}
});
};

const basicGI1 = (fdc3: DesktopAgent, documentation: string) => {
it('(BasicGI1) Returns ImplementationMetadata object', async () => {
try {
Expand Down Expand Up @@ -307,6 +335,7 @@ declare let fdc3: DesktopAgent;

const documentation_CL = '\r\nDocumentation: ' + APIDocumentation.addContextListener + '\r\nCause';
const documentation_IL = '\r\nDocumentation: ' + APIDocumentation.addIntentListener + '\r\nCause';
const documentation_AEL = '\r\nDocumentation: ' + APIDocumentation.addEventListener + '\r\nCause';
const documentation_GI = '\r\nDocumentation: ' + APIDocumentation.getInfo + '\r\nCause';
const documentation_AC = '\r\nDocumentation: ' + APIDocumentation.getOrCreateChannel + '\r\nCause';
const documentation_UC = '\r\nDocumentation: ' + APIDocumentation.getUserChannels + '\r\nCause';
Expand All @@ -319,6 +348,8 @@ export const fdc3BasicGetAgent = async () => describe('fdc3.basicGetAgent', () =
export const fdc3BasicCL1 = async () => describe('fdc3.basicCL1', () => basicCL1(fdc3, documentation_CL));
export const fdc3BasicCL2 = async () => describe('fdc3.basicCL2', () => basicCL2(fdc3, documentation_CL));
export const fdc3BasicIL1 = async () => describe('fdc3.basicIL1', () => basicIL1(fdc3, documentation_IL));
export const fdc3BasicAEL1 = async () => describe('fdc3.basicAEL1', () => basicAEL1(fdc3, documentation_AEL));
export const fdc3BasicAEL2 = async () => describe('fdc3.basicAEL2', () => basicAEL2(fdc3, documentation_AEL));
export const fdc3BasicGI1 = async () => describe('fdc3.basicGI1', () => basicGI1(fdc3, documentation_GI));
export const fdc3BasicGI2 = async () => describe('fdc3.basicGI2', () => basicGI2(fdc3, documentation_GI));
export const fdc3BasicAC1 = async () => describe('fdc3.basicAC1', () => basicAC1(fdc3, documentation_AC));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const APIDocumentation = {
getAgent: 'https://fdc3.finos.org/docs/api/ref/GetAgent',
desktopAgent: 'https://fdc3.finos.org/docs/api/ref/DesktopAgent',
addContextListener: 'https://fdc3.finos.org/docs/api/ref/DesktopAgent#addcontextlistener',
addEventListener: 'https://fdc3.finos.org/docs/api/ref/DesktopAgent#addeventlistener',
addIntentListener: 'https://fdc3.finos.org/docs/api/ref/DesktopAgent#addintentlistener',
broadcast: 'https://fdc3.finos.org/docs/api/ref/DesktopAgent#broadcast',
findIntent: 'https://fdc3.finos.org/docs/api/ref/DesktopAgent#findintent',
Expand Down
4 changes: 4 additions & 0 deletions toolbox/fdc3-conformance/src/test/testSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
fdc3BasicCL1,
fdc3BasicCL2,
fdc3BasicIL1,
fdc3BasicAEL1,
fdc3BasicAEL2,
fdc3BasicGI1,
fdc3BasicGI2,
fdc3BasicAC1,
Expand All @@ -44,6 +46,8 @@ const basicSuite: testSet = {
'fdc3.basicCL1': [fdc3BasicCL1],
'fdc3.basicCL2': [fdc3BasicCL2],
'fdc3.basicIL1': [fdc3BasicIL1],
'fdc3.basicAEL1': [fdc3BasicAEL1],
'fdc3.basicAEL2': [fdc3BasicAEL2],
'fdc3.basicGI1': [fdc3BasicGI1],
'fdc3.basicGI2': [fdc3BasicGI2],
'fdc3.basicAC1': [fdc3BasicAC1],
Expand Down
2 changes: 2 additions & 0 deletions website/docs/api/conformance/Basic-Tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ _These are some basic sanity tests implemented in the FDC3 Conformance Framework
- `BasicCL1` ![2.0+](https://img.shields.io/badge/FDC3-2.0+-blue): A context listener can be created for a specific context type by calling `fdc3.addContextListener("fdc3.contact",<handler>)`. A `Listener` object is returned and can be used to remove the listener again by calling its `unsubscribe` function.
- `BasicCL2` ![2.0+](https://img.shields.io/badge/FDC3-2.0+-blue): An **unfiltered** context listener can be created by calling `fdc3.addContextListener(null,<handler>)`. A `Listener` object is returned and can be used to remove the listener again by calling its `unsubscribe` function.
- `BasicIL1` ![2.0+](https://img.shields.io/badge/FDC3-2.0+-blue): An intent listener can be created for a specific intent by calling `fdc3.addIntentListener(<intentName>,<handler>)`. A `Listener` object is returned and can be used to remove the listener again by calling its `unsubscribe` function.
- `BasicAEL1` ![2.2+](https://img.shields.io/badge/FDC3-2.2+-purple): An event listener can be created for a specific event type by calling `fdc3.addEventListener("userChannelChanged",<handler>)`. A `Listener` object is returned and can be used to remove the listener again by calling its `unsubscribe` function.
- `BasicAEL2` ![2.2+](https://img.shields.io/badge/FDC3-2.2+-purple): An **unfiltered** event listener can be created by calling `fdc3.addEventListener(null,<handler>)`. A `Listener` object is returned and can be used to remove the listener again by calling its `unsubscribe` function.
- `BasicGI1` ![2.0+](https://img.shields.io/badge/FDC3-2.0+-blue): An `ImplementationMetadata` object can be retrieved, to find out the version of FDC3 that is in use along with details of the provider, by calling:
- `await fdc3.getInfo()`. The FDC3 version should match the API version being tested for conformance.
- `BasicAC1` ![2.0+](https://img.shields.io/badge/FDC3-2.0+-blue): A named 'App' channel can be retrieved by calling `fdc3.getOrCreateChannel(<name>)`. The `Channel` object returned conforms to the defined interface.
Expand Down
Loading