GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 1094b2...af4f1c )
by Vladimir
36s
created

test/unit/routes/index.test.js   A

Complexity

Total Complexity 10
Complexity/F 1

Size

Lines of Code 83
Function Count 10

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
cc 0
wmc 10
c 5
b 0
f 0
nc 1
mnd 0
bc 9
fnc 10
dl 0
loc 83
rs 10
bpm 0.9
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B index.test.js ➔ ??? 0 81 1
1
/** global: jest */
2
3
const router = require('./../../../src/routes/index');
4
5
describe('Index routes.', () => {
6
  test('GET homepage', (done) => {
7
    const request = {
8
      method: 'GET',
9
      url: '/',
10
    };
11
    const response = {
12
      redirect: (targetUrl) => {
13
        expect(targetUrl).toMatch(/.+/);
14
        done();
15
      },
16
    };
17
18
    router.handle(request, response);
19
  });
20
21
  test('GET page by streamId', (done) => {
22
    const request = {
23
      method: 'GET',
24
      url: '/testId',
25
    };
26
    const response = {
27
      render: (tpl, data) => {
28
        expect(tpl).toBe('index');
29
        expect(typeof data).toBe('object');
30
        done();
31
      },
32
    };
33
34
    router.handle(request, response);
35
  });
36
37
  /**
38
   * This block describes test cases related to POSTing data into page.
39
   */
40
  describe('POST data into page with certain streamId.', () => {
41
    test('POST plain text', (done) => {
42
      const request = {
43
        method: 'POST',
44
        url: '/testId',
45
        headers: {
46
          'x-forwarded-for': 'testIp',
47
          'content-type': 'text',
48
        },
49
        body: 'Test with plain text body.',
50
      };
51
      const response = {
52
        status: jest.fn(),
53
        send: () => done(),
54
      };
55
56
      router.handle(request, response);
57
    });
58
59
    test('POST JSON data', (done) => {
60
      const request = {
61
        method: 'POST',
62
        url: '/testId',
63
        headers: { 'content-type': 'application/json' },
64
        connection: {
65
          socket: { remoteAddress: 'testIp' },
66
        },
67
        socket: {},
68
        body: '{"decs": "JSON data"}',
69
      };
70
      const response = {
71
        status: jest.fn(),
72
        send: jest.fn(),
73
      };
74
      global.socket = {
75
        emit: (type, data) => {
76
          expect(type).toBe('log');
77
          expect(typeof data).toBe('object');
78
          done();
79
        },
80
      };
81
82
      router.handle(request, response);
83
    });
84
  });
85
});
86