Skip to content

Commit

Permalink
fix(tests): Implement test in a more streamlined manner
Browse files Browse the repository at this point in the history
- describe block for implemented for all tests
- extra tests implemented for new authenticated routes
- Coverage for client side back up to 95 %
- Naming conventions changed to correct case
- Test cases refactored to improve test

- TestHook introduced to implement better seeding of token
  • Loading branch information
Benny Ogidan authored and Benny Ogidan committed Jan 3, 2018
1 parent d3d706f commit 83d9b14
Show file tree
Hide file tree
Showing 16 changed files with 1,303 additions and 1,000 deletions.
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
80,
2
],
"max-nested-callbacks": [2, 7],
"max-depth": [2, {
"max": 2
}],
"import/no-unresolved": [
2,
{
Expand Down
9 changes: 5 additions & 4 deletions server/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

app.use('/api-docs', express.static(path.join(__dirname, '../../apiDocs/')));
app.use('/apiDocs', express.static(path.join(__dirname, '../../apiDocs/')));
app.use(express.static(path.join(__dirname, '../../client/dist/app')));

app.use((req, res, next) => {
res.header(
'Access-Control-Allow-Headers',
'Authorization, X-PINGOTHER, Origin, X-Requested-With,' +
'Content-Type, Accept, x-ac' +
'cess-token'
'Content-Type, Accept, x-access-token'
);
next();
});

app.use('/api/v1', authenticateRoutes, routes);

app.get('*', (req, res) => res.sendFile(path.join(__dirname, '../../client/dist/app/index.html')));
app
.get('*', (req, res) =>
res.sendFile(path.join(__dirname, '../../client/dist/app/index.html')));

export default(app);
10 changes: 5 additions & 5 deletions server/src/controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ const userController = {
}).then((user) => {
if (user) {
res.status(201).send({
message: `${user.username} has
been added to the library, ` +
'Please Login, you will be only required to do this once'
message: `${user.username} has been added to
the library, 'Please Login, you will be only ` +
'required to do this once'
});
}
});
Expand Down Expand Up @@ -179,8 +179,8 @@ const userController = {
return res.status(409)
.send({
message:
'Your current password does not match our records,'
+ 'Please Re-enter'
'Your current password does not match our records, ' +
'Please Re-enter'
});
}
const compareNewPasswords =
Expand Down
4 changes: 0 additions & 4 deletions server/src/routes/.hound.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import faker from 'faker';

require('dotenv').config();


const bcrypt = require('bcrypt');

Expand All @@ -18,7 +20,7 @@ module.exports = {
},
{
username: 'bennyogidan',
password: bcrypt.hashSync('bennyogidan', bcrypt.genSaltSync(10)),
password: bcrypt.hashSync(process.env.ADMIN_PASSWORD, bcrypt.genSaltSync(10)),
email: 'benfluleck@gmail.com',
firstname: 'Administrator',
isAdmin: true,
Expand Down
Loading

0 comments on commit 83d9b14

Please sign in to comment.