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 ( 82b9d9...562a49 )
by Vladimir
38s
created

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

Complexity

Total Complexity 10
Complexity/F 1

Size

Lines of Code 79
Function Count 10

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

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