Skip to content

Commit

Permalink
style(reactive-rpc): 💄 run Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Dec 30, 2023
1 parent 9df37a0 commit c209dc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/reactive-rpc/server/ws/server/WsServerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class WsServerConnection {
const isLast = currentFrameHeader.fin === 1;
currentFrameHeader = null;
if (isLast) fragmentStartFrameHeader = null;
this.onfragment(isLast, buf, isText)
this.onfragment(isLast, buf, isText);
} else {
const isText = currentFrameHeader.opcode === WsFrameOpcode.TEXT;
currentFrameHeader = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,7 @@ describe('.onmessage', () => {
encoder.writer.buf(Buffer.from([0x04, 0x05, 0x06]), 3);
const payload2 = encoder.writer.flush();
socket.write(pingFrame);
socket.write(listToUint8([
frame1,
payload1,
frame2,
payload2,
]));
socket.write(listToUint8([frame1, payload1, frame2, payload2]));
await until(() => messages.length === 2);
expect(messages[0]).toEqual([new Uint8Array([0x01, 0x02, 0x03]), false]);
expect(messages[1]).toEqual([new Uint8Array([0x04, 0x05, 0x06]), false]);
Expand All @@ -135,18 +130,13 @@ describe('.onmessage', () => {
encoder.writer.buf(Buffer.from([0x04, 0x05, 0x06, 0x07]), 4);
const payload2 = encoder.writer.flush();
socket.write(pingFrame);
socket.write(listToUint8([
frame1,
payload1,
frame2,
payload2,
]));
socket.write(listToUint8([frame1, payload1, frame2, payload2]));
await until(() => messages.length === 1);
await until(() => closes.length === 1);
expect(messages[0]).toEqual([new Uint8Array([0x01, 0x02, 0x03]), false]);
expect(closes[0]).toEqual([1009, 'TOO_LARGE']);
});

test('text frame', async () => {
const {socket, encoder, connection} = setup();
const messages: [data: Uint8Array, isUtf8: boolean][] = [];
Expand Down Expand Up @@ -184,7 +174,7 @@ describe('.onmessage', () => {
await until(() => messages.length === 1);
expect(messages[0]).toEqual([new Uint8Array([0x01, 0x02, 0x03]), false]);
});

test('text frame', async () => {
const {socket, encoder, connection} = setup();
const messages: [data: Uint8Array, isUtf8: boolean][] = [];
Expand Down Expand Up @@ -263,9 +253,7 @@ describe('.onfragment', () => {
socket.write(buf5);
socket.write(buf6);
await until(() => messages.length === 1);
expect(messages).toEqual([
[new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,0x08, 0x09]), false],
]);
expect(messages).toEqual([[new Uint8Array([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09]), false]]);
});

test('errors out when incoming message is too large', async () => {
Expand Down Expand Up @@ -293,9 +281,7 @@ describe('.onfragment', () => {
socket.write(buf5);
socket.write(buf6);
await until(() => closes.length === 1);
expect(closes).toEqual([
[1009, 'TOO_LARGE'],
]);
expect(closes).toEqual([[1009, 'TOO_LARGE']]);
});
});
});

0 comments on commit c209dc2

Please sign in to comment.