Skip to content

Commit

Permalink
164796898-feature(signupApi): user will be able to signup
Browse files Browse the repository at this point in the history
[Delivers #164796890]
  • Loading branch information
toluola committed Apr 10, 2019
1 parent 708ffb8 commit 3530aa5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/config/databaseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ module.exports = {
port: process.env.DB_PORT,
username: process.env.DB_USER,
dialect: 'postgres',
dialectOptions: {
ssl: process.env.HEROKU_AUTH !== '',
},
// dialectOptions: {
// ssl: process.env.HEROKU_AUTH !== '',
// },
logging: false,
},
production: {
Expand Down
7 changes: 3 additions & 4 deletions src/controllers/authentication/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ export const createUser = async (req, res) => {
const { id, username, email, role, fullName, bio } = user;

if (user) {
const token = Auth.generateToken({
id, username, email, role, fullName, bio
});
return res.status(201).json(responseFormat({
status: 'success',
data: {
token,
token: Auth.generateToken({
id, fullName, bio, email, username, role
})
},
}));
}
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import chai from 'chai';
import chaiHttp from 'chai-http';
import jwt from 'jsonwebtoken';
import { startServer } from '../../src/server';
import { createUser, createUserErrorSecond, createUserErrorThird } from '../mock/user';
import { createUser, createUserEmailError, createUserOtherError } from '../mock/user';

const { expect } = chai;

Expand Down Expand Up @@ -59,7 +59,7 @@ describe('Signup Authentication Test', () => {
it('Should return error for usernamne', (done) => {
agent
.post('/api/v1/signup')
.send(createUserErrorSecond)
.send(createUserEmailError)
.end((err, res) => {
expect(res).to.have.status(409);
expect(res.body)
Expand All @@ -74,7 +74,7 @@ describe('Signup Authentication Test', () => {
it('Should return error for other errors', (done) => {
agent
.post('/api/v1/signup')
.send(createUserErrorThird)
.send(createUserOtherError)
.end((err, res) => {
expect(res).to.have.status(500);
expect(res.body)
Expand Down
4 changes: 2 additions & 2 deletions tests/mock/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const createUserError = {
bio: 'I Love Javascript',
imageUrl: 'http://waterease.herokuapp.com/images/board/comfort.com'
};
export const createUserErrorSecond = {
export const createUserEmailError = {
fullName: 'Tolulope Olaniyan',
email: 'tolulope3@gmail.com',
username: 'tolulope',
Expand All @@ -22,7 +22,7 @@ export const createUserErrorSecond = {
imageUrl: 'http://waterease.herokuapp.com/images/board/comfort.com'
};

export const createUserErrorThird = {
export const createUserOtherError = {
fullName: 'Tolulope Olaniyan',
email: 'tolulope3gmail.com',
username: 'tolulope',
Expand Down

0 comments on commit 3530aa5

Please sign in to comment.