Typed stream (#13)

* Update streaming.ts

* Update streaming.ts

* wip
This commit is contained in:
syuilo
2021-05-17 19:50:31 +09:00
committed by GitHub
parent d7d02cd2bc
commit 99276028ae
3 changed files with 174 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ describe('Streaming', () => {
const stream = new Stream('https://misskey.test', { token: 'TOKEN' });
const mainChannelReceived: any[] = [];
const main = stream.useSharedConnection('main');
main.on('foo', payload => {
main.on('meUpdated', payload => {
mainChannelReceived.push(payload);
});
await server.connected;
@@ -21,15 +21,15 @@ describe('Streaming', () => {
type: 'channel',
body: {
id: mainChannelId,
type: 'foo',
type: 'meUpdated',
body: {
bar: 'buzz'
id: 'foo'
}
}
}));
expect(mainChannelReceived[0]).toEqual({
bar: 'buzz'
id: 'foo'
});
});
});