Skip to content

Commit

Permalink
Set MockAuthServer clientId as string or null, updated tests to inclu…
Browse files Browse the repository at this point in the history
…de clientId
  • Loading branch information
sacOO7 committed Jul 9, 2024
1 parent 18529c2 commit a49b8c8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/ably/ably-channel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ describe('AblyChannel', () => {
});

test('Leave channel', async () => {
mockAuthServer.clientId = '[email protected]'
const publicChannel = echo.channel('test') as AblyChannel;
const privateChannel = echo.private('test') as AblyChannel;
const presenceChannel = echo.join('test') as AblyPresenceChannel;
Expand Down
1 change: 1 addition & 0 deletions tests/ably/ably-presence-channel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('AblyPresenceChannel', () => {
global.Ably = Ably;
testApp = await setup();
mockAuthServer = new MockAuthServer(testApp.keys[0].keyStr);
mockAuthServer.clientId = '[email protected]'
});

afterAll(async () => {
Expand Down
3 changes: 2 additions & 1 deletion tests/ably/ably-private-channel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('AblyPrivateChannel', () => {
global.Ably = Ably;
testApp = await setup();
mockAuthServer = new MockAuthServer(testApp.keys[0].keyStr);
mockAuthServer.clientId = '[email protected]'
});

afterAll(async () => {
Expand All @@ -39,7 +40,7 @@ describe('AblyPrivateChannel', () => {
});

test('channel subscription', (done) => {
const privateChannel = echo.private('test') as AblyChannel;
const privateChannel = echo.private('test') as AblyPrivateChannel;
privateChannel.subscribed(() => {
privateChannel.unregisterSubscribed();
done();
Expand Down
2 changes: 1 addition & 1 deletion tests/ably/setup/mock-auth-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class MockAuthServer {
keyName: string;
keySecret: string;
ablyClient: Ably.Rest;
clientId = '[email protected]';
clientId: string | null;
userInfo = { id: '[email protected]', name: 'sacOO7' };

shortLived: channels;
Expand Down

0 comments on commit a49b8c8

Please sign in to comment.