SDA-4657: Patch for OpenFin (#2271)

This commit is contained in:
Antoine Rollin
2025-01-23 20:00:19 +01:00
committed by GitHub
parent 72be5a43cb
commit 2a85238443
7 changed files with 117 additions and 61 deletions

View File

@@ -13,9 +13,10 @@ jest.mock('@openfin/node-adapter', () => ({
registerIntentHandler: jest.fn(),
getAllClientsInContextGroup: jest.fn(),
joinContextGroup: jest.fn(),
joinSessionContextGroup: jest.fn(),
getContextGroups: jest.fn(),
fireIntentForContext: jest.fn(),
removeClientFromContextGroup: jest.fn(),
removeFromContextGroup: jest.fn(),
}),
},
});
@@ -185,6 +186,19 @@ describe('Openfin', () => {
expect(joinContextGroupSpy).toHaveBeenCalledTimes(1);
});
it('should join a session context group', async () => {
const connectSyncMock = await connectMock.Interop.connectSync();
const joinSessionContextGroupSpy = jest.spyOn(
connectSyncMock,
'joinSessionContextGroup',
);
await openfinHandler.connect();
await openfinHandler.joinSessionContextGroup('contextGroupId');
expect(joinSessionContextGroupSpy).toHaveBeenCalledTimes(1);
});
it('should return all context groups', async () => {
const connectSyncMock = await connectMock.Interop.connectSync();
const getContextGroupsSpy = jest.spyOn(connectSyncMock, 'getContextGroups');
@@ -210,7 +224,10 @@ describe('Openfin', () => {
it('should fire an intent for a given context', async () => {
const connectSyncMock = await connectMock.Interop.connectSync();
const fireIntentSpy = jest.spyOn(connectSyncMock, 'fireIntentForContext');
const fireIntentForContextSpy = jest.spyOn(
connectSyncMock,
'fireIntentForContext',
);
await openfinHandler.connect();
const context = {
@@ -222,18 +239,18 @@ describe('Openfin', () => {
};
await openfinHandler.fireIntentForContext(context);
expect(fireIntentSpy).toHaveBeenCalledTimes(1);
expect(fireIntentForContextSpy).toHaveBeenCalledTimes(1);
});
it('should remove client from context group', async () => {
it('should remove from context group', async () => {
const connectSyncMock = await connectMock.Interop.connectSync();
const fireIntentSpy = jest.spyOn(
const removeFromContextGroupSpy = jest.spyOn(
connectSyncMock,
'removeClientFromContextGroup',
'removeFromContextGroup',
);
await openfinHandler.removeClientFromContextGroup();
await openfinHandler.removeFromContextGroup();
expect(fireIntentSpy).toHaveBeenCalledTimes(1);
expect(removeFromContextGroupSpy).toHaveBeenCalledTimes(1);
});
});