Skip to content

Commit 9054397

Browse files
committed
changed config require to import, all tests to expect
1 parent 54a8145 commit 9054397

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

server/controllers/auth.controller.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import jwt from 'jsonwebtoken';
22
import httpStatus from 'http-status';
33
import APIError from '../helpers/APIError';
4-
5-
const config = require('../../config/env');
4+
import config from '../../config/env';
65

76
// sample user, used for authentication
87
const user = {

server/tests/auth.test.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import httpStatus from 'http-status';
33
import jwt from 'jsonwebtoken';
44
import chai, { expect } from 'chai';
55
import app from '../../index';
6-
7-
const config = require('../../config/env');
8-
const should = require('chai').should();
6+
import config from '../../config/env';
97

108
chai.config.includeStack = true;
119

@@ -23,9 +21,9 @@ describe('## AUTH APIs', () => {
2321
.send(user)
2422
.expect(httpStatus.OK)
2523
.then((res) => {
26-
should.exist(res.body.token);
24+
expect(res.body).to.have.property('token');
2725
jwt.verify(res.body.token, config.jwtSecret, (err, decoded) => {
28-
should.not.exist(err);
26+
expect(err).to.not.be.ok; // eslint-disable-line no-unused-expressions
2927
expect(decoded.username).to.equal(user.username);
3028
jwtToken = `Bearer ${res.body.token}`;
3129
done();

0 commit comments

Comments
 (0)