Skip to content

Stephen Swaringin sunglasses-io#167

Open
sswaringin wants to merge 7 commits intoprojectshft:masterfrom
sswaringin:master
Open

Stephen Swaringin sunglasses-io#167
sswaringin wants to merge 7 commits intoprojectshft:masterfrom
sswaringin:master

Conversation

@sswaringin
Copy link

No description provided.

app/server.js Outdated
const { brandId } = req.params;
// Are there any matching brand IDs?
const matchingProducts = products.filter(product => product.categoryId === brandId);
if (matchingProducts.length === 0) {

Choose a reason for hiding this comment

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

its not really an error that there are no products with this brand

app/server.js Outdated
// Did the request query parameters include a productId?
const productId = req.params.productId;
if (!productId) {
return res.status(400).send('Missing required query parameter');

Choose a reason for hiding this comment

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

be more specific with the error, here you are missing productId

app/server.js Outdated
}

if (Number(quantity) === 0 || quantity > 1000) {
return res.status(403).send('Unable to update the quantity to that value');

Choose a reason for hiding this comment

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

this is not the correct error code. The client sent wrong value, its 400!

Suggested change
return res.status(403).send('Unable to update the quantity to that value');
return res.status(400).send('Unable to update the quantity to that value');

Copy link

@ronyrosenberg ronyrosenberg left a comment

Choose a reason for hiding this comment

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

Great job!
2 tests are still failing
image

const { brandId } = req.params;
// Are there any matching brand IDs?
const matchingProducts = products.filter(product => product.categoryId === brandId);
// if (matchingProducts.length === 0) {

Choose a reason for hiding this comment

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

remove commented code

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.

2 participants