Skip to content

Commit 7542f18

Browse files
knagaitsevhiroppy
authored andcommitted
test(server/client): make sockjs implementation tests use snapshots (#2070)
1 parent 09d888f commit 7542f18

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

test/client/clients/SockJSClient.test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ describe('SockJSClient', () => {
4848
});
4949

5050
setTimeout(() => {
51-
expect(data.length).toEqual(3);
52-
expect(data[0]).toEqual('open');
53-
expect(data[1]).toEqual('hello world');
54-
expect(data[2]).toEqual('close');
51+
expect(data).toMatchSnapshot();
5552
done();
5653
}, 3000);
5754
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`SockJSClient client should open, receive message, and close 1`] = `
4+
Array [
5+
"open",
6+
"hello world",
7+
"close",
8+
]
9+
`;

test/server/servers/SockJSServer.test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ describe('SockJSServer', () => {
5454
};
5555

5656
setTimeout(() => {
57-
expect(data.length).toEqual(3);
58-
expect(data[0]).toEqual('open');
59-
expect(data[1]).toEqual('hello world');
60-
expect(data[2]).toEqual('close');
57+
expect(data).toMatchSnapshot();
6158
done();
6259
}, 3000);
6360
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`SockJSServer server should recieve connection, send message, and close client 1`] = `
4+
Array [
5+
"open",
6+
"hello world",
7+
"close",
8+
]
9+
`;

0 commit comments

Comments
 (0)