Issues (3)

tests/package/configurations.test.js (1 issue)

Labels
Severity
1
import jsonServer from 'json-server';
2
import { assert } from 'chai';
3
import axios from 'axios';
4
import bodyParser from 'body-parser';
5
import curl from '../entry';
6
7
const port = 12_653;
0 ignored issues
show
The variable _653 seems to be never declared. If this is a global, consider adding a /** global: _653 */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
8
const users = [ {
9
    'id'    : 1,
10
    'name'  : 'Leigh',
11
    'email' : '[email protected]'
12
}, {
13
    'id'    : 2,
14
    'name'  : 'Ancell',
15
    'email' : '[email protected]'
16
} ];
17
18
const server = jsonServer.create();
19
const router = jsonServer.router({ users });
20
21
suite('Default configuration');
22
23
before(async function () {
24
    server.use(bodyParser.json());
25
    server.use(curl);
26
    server.use(router);
27
    await new Promise(res => {
28
        server.listen(port, res);
29
    });
30
});
31
32
test('Get all users', async function () {
33
    assert.deepEqual(
34
        await axios({
35
            method : 'GET',
36
            url    : `http://localhost:${port}/users?limit=5`
37
        }).then(r => r.data),
38
        users
39
    );
40
});
41