Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#149760707 Users should be able to read books within the app #55

Merged
merged 20 commits into from
Dec 20, 2017

Conversation

segunolalive
Copy link
Owner

What does this PR do?

adds the ability to read books within the app

Description of Task to be completed?

Users should be able to read books within the app

How should this be manually tested?

Navigate to the app, click to read a borrowed book from the dashboard

What are the relevant pivotal tracker stories?

#149760707

Screenshots (if appropriate)

localhost_8080_library 2

@segunolalive segunolalive temporarily deployed to segunolalive-hellobooks-pr-55 December 20, 2017 11:12 Inactive
* renders reset password form
*
* @param {object} props
*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

/**
* renders reset password form
*
* @param {object} props

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

@@ -6,6 +6,13 @@ import Header from '../Header';
import Loading from '../common/Loading';


/**
* renders reset password form
*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

* @param {object} props
*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

* @memberof Password
*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

/**
* renders forgot password form
*
* @param {object} props

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces


/**
* renders forgot password form
*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

'templates/images/eloquentjs_cover.png'}
src={(props.cover &&
requestImageUrl(props.cover, { width: 80 })) ||
BOOK_IMAGE_FALLBACK }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'BOOK_IMAGE_FALLBACK' is not defined no-undef

/**
* class method that renders a component to the DOM
*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

* @param {Object} event DOM onSubmit event
* @return {Undefined} sends a network request
*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

@coveralls
Copy link

Coverage Status

Coverage increased (+1.5%) to 89.402% when pulling 3b81b8e on feature/read-book into f1104ae on development.

@segunolalive segunolalive had a problem deploying to segunolalive-hellobooks-pr-55 December 20, 2017 12:33 Failure
sandbox = sandbox.restore();
done();
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

done();
});
});
it('should send a message if an error occured while getting notifications',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

assert.equal(res.body.metadata.total, 3);
assert(res.body.notifications.length > 0);
assert.equal(res.body.notifications[0].type, 'return');
assert.equal(res.body.notifications[0].bookTitle, 'eloquent javascript');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 36 exceeds the maximum line length of 80 max-len

server.get('/api/v1/books/1')
.expect(500)
.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message, 'Something went wrong. Internal server error')
assert.equal(res.body.message,
'Something went wrong. Internal server error');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

server.get('/api/v1/books/1')
.expect(500)
.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message, 'Something went wrong. Internal server error')
assert.equal(res.body.message,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message,
'Something went wrong. Internal server error');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

.expect(500)
.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

Book.findById = () => Promise.reject(1);
});
describe('deleteBook', () => {
it('should send a message if an error occurs while deleting book',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message,
'Something went wrong. Internal server error');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

.expect(500)
.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

@segunolalive segunolalive had a problem deploying to segunolalive-hellobooks-pr-55 December 20, 2017 13:29 Failure
expect(error.errors[0].path).to.equal('email');
done();
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

});
});

it('should raise validation error if email already exists',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

expect(error.errors[0].path).to.equal('email');
done();
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

});
});

it('should raise validation error if email field is missing',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

expect(error.errors[0].type).to.equal('notNull Violation');
done();
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

});
});

it('should raise validation error if title field is missing',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

'Something went wrong. Internal server error');
done();
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message,
'Something went wrong. Internal server error');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

.expect(500)
.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

});
});

it('should send a message if an error occurs while verifying an account',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

@segunolalive segunolalive had a problem deploying to segunolalive-hellobooks-pr-55 December 20, 2017 13:47 Failure
);
next();
});
}

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

app.use('/', express.static(path.join(__dirname, 'client/static')));
app.use('/',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline after '(' function-paren-newline

@@ -27,32 +27,27 @@ if (
);
res.header(
'Access-Control-Allow-Headers',
'Authorization, X-PINGOTHER, Origin, X-Requested-With,' +
'Content-Type, Accept, x-access-token'
'Authorization, X-PINGOTHER, Origin, X-Requested-With, Content-Type, Accept, x-access-token'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 30 exceeds the maximum line length of 80 max-len

.click('#borrow-book-2-btn')
.waitForElementVisible('#toast-container')
.assert.urlEquals('http://localhost:8080/library')
.assert.containsText('.toast', 'You currently have this book. Return ' +
'it before trying to borrow it again')
.assert.containsText('.toast', 'You currently have this book. Return it before trying to borrow it again')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 55 exceeds the maximum line length of 80 max-len

.click('#borrow-book-2-btn')
.waitForElementVisible('#toast-container')
.assert.urlEquals('http://localhost:8080/library')
.assert.containsText('.toast', 'You have successfully borrowed ' +
'eloquent ruby again. Check your dashboard to read it')
.assert.containsText('.toast', 'You have successfully borrowed eloquent ruby again. Check your dashboard to read it')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 38 exceeds the maximum line length of 80 max-len

.assert.containsText('.toast', 'You have successfully returned ' +
'eloquent javascript')
.assert.containsText('.toast',
'You have successfully returned eloquent javascript')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

event.waitUntil(self.registration.showNotification(title, options));
});

self.addEventListener('fetch', (event) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected use of 'self' no-restricted-globals

const options = {
body: event.data.text()
};
event.waitUntil(self.registration.showNotification(title, options));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected use of 'self' no-restricted-globals

workbox.router.registerRoute('/api-docs/', workbox.strategies.networkFirst());


self.addEventListener('push', (event) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected use of 'self' no-restricted-globals

importScripts('workbox-sw.prod.js');


const workbox = new WorkboxSW({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'WorkboxSW' is not defined no-undef

});
}
}
importScripts('workbox-sw.prod.js');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'importScripts' is not defined no-undef

@segunolalive segunolalive temporarily deployed to segunolalive-hellobooks-pr-55 December 20, 2017 13:55 Inactive
const email = userData.email;
delete req.body.isAdmin;
const username = req.body.username;
const email = req.body.email;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use object destructuring prefer-destructuring

const username = userData.username;
const email = userData.email;
delete req.body.isAdmin;
const username = req.body.username;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use object destructuring prefer-destructuring

const defaulters = () => (
/**
* function for sending emails to defaulters
*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

});
}
return res.status(403).send({
message: 'This book is currently not on your list.' +
' You have either returned it or never borrowed it'
message: 'This book is currently not on your list. You have either returned it or never borrowed it'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 345 exceeds the maximum line length of 80 max-len

@@ -216,8 +255,7 @@ const bookController = {
.then((borrowed) => {
if (borrowed && borrowed.returned === false) {
return res.status(403).send({
message: 'You currently have this book.' +
' Return it before trying to borrow it again',
message: 'You currently have this book. Return it before trying to borrow it again',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 258 exceeds the maximum line length of 80 max-len

where: { id },
returning: true,
plain: true,
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

message:
'Successfully added new category, ' +
`${category.category}, to Library`,
`Successfully added new category, ${category.category}, to Library`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 32 exceeds the maximum line length of 80 max-len

</figure>
</div>
</Link>
) : <h5 className="center">Nothing here</h5>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected newline before ')' function-paren-newline

<figcaption>
<h5 className="bold-text">{book.title || ''}</h5 >
</figcaption>
<img src={book.cover || BOOK_IMAGE_FALLBACK}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'BOOK_IMAGE_FALLBACK' is not defined no-undef

</div>}
<div className="pdf-container">
<PDF
file={this.props.bookUrl || BOOK_FALLBACK}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'BOOK_FALLBACK' is not defined no-undef

'Something went wrong. Internal server error');
done();
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message,
'Something went wrong. Internal server error');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

'Something went wrong. Internal server error');
done();
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

.end((err, res) => {
assert.equal(res.status, 500);
assert.equal(res.body.message,
'Something went wrong. Internal server error');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

@coveralls
Copy link

coveralls commented Dec 20, 2017

Coverage Status

Coverage increased (+1.5%) to 89.402% when pulling 72f8980 on feature/read-book into f1104ae on development.

@segunolalive segunolalive merged commit 8bda0cf into development Dec 20, 2017
@segunolalive segunolalive temporarily deployed to segunolalive-hellobooks December 21, 2017 08:21 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants