Total Complexity | 5 |
Complexity/F | 1 |
Lines of Code | 24 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** global: jest */ |
||
3 | const jsonRequest = require('./../../../stubs/routes/jsonRequest'); |
||
4 | const plainRequest = require('./../../../stubs/routes/plainRequest'); |
||
5 | const router = require('./../../../../../src/back/routes/index'); |
||
6 | |||
7 | describe('Index routes.', () => { |
||
8 | test('POST plain text into page with certain streamId', (done) => { |
||
9 | const response = { status: jest.fn(), send: () => done() }; |
||
10 | |||
11 | router.handle(plainRequest, response); |
||
12 | }); |
||
13 | |||
14 | test('POST JSON data into page with certain streamId', (done) => { |
||
15 | const response = { status: jest.fn(), send: jest.fn() }; |
||
16 | global.socket = { |
||
17 | emit: (type, data) => { |
||
18 | expect(type).toBe('log'); |
||
19 | expect(typeof data).toBe('object'); |
||
20 | done(); |
||
21 | }, |
||
22 | }; |
||
23 | |||
24 | router.handle(jsonRequest, response); |
||
25 | }); |
||
26 | }); |
||
27 |