mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-29 19:26:44 -06:00
add test
This commit is contained in:
parent
05a902f3a5
commit
78861f8a31
1 changed files with 21 additions and 0 deletions
|
@ -93,6 +93,27 @@ describe('Streaming', () => {
|
||||||
server.close();
|
server.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Connection#send', async () => {
|
||||||
|
const server = new WS('wss://misskey.test/streaming');
|
||||||
|
const stream = new Stream('https://misskey.test', { token: 'TOKEN' });
|
||||||
|
|
||||||
|
const messaging = stream.useChannel('messaging', { otherparty: 'aaa' });
|
||||||
|
messaging.send('read', { id: 'aaa' });
|
||||||
|
|
||||||
|
await server.connected;
|
||||||
|
const connectMsg = JSON.parse(await server.nextMessage as string);
|
||||||
|
const channelId = connectMsg.body.id;
|
||||||
|
const msg = JSON.parse(await server.nextMessage as string);
|
||||||
|
|
||||||
|
expect(msg.type).toEqual('ch');
|
||||||
|
expect(msg.body.id).toEqual(channelId);
|
||||||
|
expect(msg.body.type).toEqual('read');
|
||||||
|
expect(msg.body.body).toEqual({ id: 'aaa' });
|
||||||
|
|
||||||
|
stream.close();
|
||||||
|
server.close();
|
||||||
|
});
|
||||||
|
|
||||||
test('Connection#dispose', async () => {
|
test('Connection#dispose', async () => {
|
||||||
const server = new WS('wss://misskey.test/streaming');
|
const server = new WS('wss://misskey.test/streaming');
|
||||||
const stream = new Stream('https://misskey.test', { token: 'TOKEN' });
|
const stream = new Stream('https://misskey.test', { token: 'TOKEN' });
|
||||||
|
|
Loading…
Reference in a new issue