-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f3833a
commit 5102d0f
Showing
9 changed files
with
87 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 18 additions & 1 deletion
19
packages/plugin-packages/mashroom-portal/src/frontend/portal-client/js/RestError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,18 +203,70 @@ describe('MashroomPortalMessageBusImpl', () => { | |
const messageBus = new MashroomPortalMessageBusImpl(); | ||
// @ts-ignore | ||
messageBus._remoteMessageClient = {}; | ||
|
||
expect(messageBus.getRemoteUserPrivateTopic()).toBe('user/testuser'); | ||
}); | ||
|
||
it('returns the user private topic of another user', () => { | ||
const messageBus = new MashroomPortalMessageBusImpl(); | ||
// @ts-ignore | ||
messageBus._remoteMessageClient = {}; | ||
|
||
expect(messageBus.getRemoteUserPrivateTopic('[email protected]')).toBe('user/[email protected]'); | ||
}); | ||
|
||
it('processes single level wildcards in remote topics correctly', async () => { | ||
const messageBus = new MashroomPortalMessageBusImpl(); | ||
// @ts-ignore | ||
messageBus._remoteMessageClient = { | ||
subscribe() { | ||
return Promise.resolve(); | ||
} | ||
}; | ||
|
||
let match = false; | ||
messageBus.subscribe(`${messageBus.getRemotePrefix()}foo/*/bar/+/xx`, () => { | ||
match = true; | ||
}); | ||
|
||
// @ts-ignore | ||
messageBus._handleRemoteMessage({}, 'foo/1/bar/2/3/xx'); | ||
await new Promise((resolve) => setTimeout(resolve, 100)); | ||
|
||
expect(match).toBeFalsy(); | ||
|
||
// @ts-ignore | ||
messageBus._handleRemoteMessage({}, 'foo/1/bar/2/xx'); | ||
await new Promise((resolve) => setTimeout(resolve, 100)); | ||
|
||
expect(match).toBeTruthy(); | ||
}); | ||
|
||
it('processes multi level wildcards in remote topics correctly', async () => { | ||
const messageBus = new MashroomPortalMessageBusImpl(); | ||
// @ts-ignore | ||
messageBus._remoteMessageClient = { | ||
subscribe() { | ||
return Promise.resolve(); | ||
} | ||
}; | ||
|
||
let match = false; | ||
messageBus.subscribe(`${messageBus.getRemotePrefix()}foo/#/xx`, () => { | ||
match = true; | ||
}); | ||
|
||
// @ts-ignore | ||
messageBus._handleRemoteMessage({}, 'foo/1/bar/2/xy'); | ||
await new Promise((resolve) => setTimeout(resolve, 100)); | ||
|
||
expect(match).toBeFalsy(); | ||
|
||
// @ts-ignore | ||
messageBus._handleRemoteMessage({}, 'foo/1/bar/2/xx'); | ||
await new Promise((resolve) => setTimeout(resolve, 100)); | ||
|
||
expect(match).toBeTruthy(); | ||
}); | ||
|
||
it('should unsubscribe after app unload', () => { | ||
const messageBus = new MashroomPortalMessageBusImpl(); | ||
const messageBusApp1 = messageBus.getAppInstance('app1'); | ||
|