Skip to content

Commit

Permalink
- Refactored tests to use new seed data
Browse files Browse the repository at this point in the history
  • Loading branch information
Benny Ogidan authored and Benny Ogidan committed Nov 29, 2017
1 parent 6e9001a commit 0d74d46
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
11 changes: 5 additions & 6 deletions client/src/app/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ form p {
.book-modal {
padding: 10px;
}
.loan-status-text{
.loan-status-text {
color: $secondary-color;
}
.modal-image{
max-width : 90%;
.modal-image {
max-width: 90%;
}
.loan-status{
.loan-status {
padding: 10px;
}
.modal-title {
Expand Down Expand Up @@ -374,7 +374,7 @@ footer {
margin-left: auto;
}

.overdue{
.overdue {
color: $base-orange;
}
.nobooks-message {
Expand Down Expand Up @@ -408,7 +408,6 @@ footer {
.landing-page-image .card {
max-width: 73% !important;
margin-left: 10px;

}
.overlay-main {
padding: 14px !important;
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/reducers/bookReducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default function bookReducer(state = {
{
return {
...state,
error
error: action

};
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/controllers/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default {
}).then((foundCategory) => {
if (foundCategory) {
return res.status(409)
.send({ message: 'You have not renamed the category' });
.send({ message: 'This Category already exists' });
}
category.update({
categoryName: req.body.categoryName
Expand Down
6 changes: 3 additions & 3 deletions server/src/test/books.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ describe('HelloBooks', () => {
.set('Accept', 'application/x-www-form-urlencoded')
.set('x-access-token', token)
.send({
title: 'Benny goes to school',
author: 'Andela Human',
title: 'Learn Java',
author: 'Sleeping Master',
categoryId: '1',
quantity: '20',
description: 'This needs to be a long description',
Expand Down Expand Up @@ -310,7 +310,7 @@ describe('HelloBooks', () => {
});
});
it('should return 200 when searching all books in a category', (done) => {
chai.request(app).get('/api/v1/books/search?searchTerm=Ben&categoryId=1').set('x-access-token', token)
chai.request(app).get('/api/v1/books/search?searchTerm=Sta&categoryId=1').set('x-access-token', token)
.end((err, res) => {
expect(res.status)
.to
Expand Down
16 changes: 8 additions & 8 deletions server/src/test/categories.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ describe('Categories', () => {
}
);
it('should return 200 when a category is modified', (done) => {
chai.request(app).put('/api/v1/admin/category/2').set('x-access-token', adminToken)
chai.request(app).put('/api/v1/admin/category/7').set('x-access-token', adminToken)
.send({
categoryName: 'Thriller'
categoryName: 'Test Category'
})
.end((err, res) => {
expect(res.status).to.equal(200);
Expand All @@ -155,7 +155,7 @@ describe('Categories', () => {
(done) => {
chai.request(app).put('/api/v1/admin/category/nkkkj').set('x-access-token', adminToken)
.send({
name: 'Thriller'
name: 'Test Category'
})
.end((err, res) => {
expect(res.status).to.equal(400);
Expand All @@ -168,7 +168,7 @@ describe('Categories', () => {
(done) => {
chai.request(app).put('/api/v1/admin/category/404').set('x-access-token', adminToken)
.send({
categoryName: 'Thriller'
categoryName: 'Test Category'
})
.end((err, res) => {
expect(res.status).to.equal(404);
Expand All @@ -181,7 +181,7 @@ describe('Categories', () => {
(done) => {
chai.request(app).put('/api/v1/admin/category/2').set('x-access-token', adminToken)
.send({
categoryName: 'Thriller'
categoryName: 'Test Category'
})
.end((err, res) => {
expect(res.status).to.equal(409);
Expand All @@ -192,7 +192,7 @@ describe('Categories', () => {
it(
'should return 200 when category is deleted',
(done) => {
chai.request(app).delete('/api/v1/admin/category/5').set('x-access-token', adminToken)
chai.request(app).delete('/api/v1/admin/category/7').set('x-access-token', adminToken)
.end((err, res) => {
expect(res.status).to.equal(200);
done();
Expand All @@ -202,9 +202,9 @@ describe('Categories', () => {
it(
'should return 404 when category to delete is not found',
(done) => {
chai.request(app).put('/api/v1/admin/category/5').set('x-access-token', adminToken)
chai.request(app).put('/api/v1/admin/category/7').set('x-access-token', adminToken)
.send({
categoryName: 'Thriller'
categoryName: 'Test Category'
})
.end((err, res) => {
expect(res.status).to.equal(404);
Expand Down

0 comments on commit 0d74d46

Please sign in to comment.