Skip to content

Michael Wagner sunglasses io Eval#168

Open
Michael-Wagner459 wants to merge 5 commits intoprojectshft:masterfrom
Michael-Wagner459:master
Open

Michael Wagner sunglasses io Eval#168
Michael-Wagner459 wants to merge 5 commits intoprojectshft:masterfrom
Michael-Wagner459:master

Conversation

@Michael-Wagner459
Copy link

Had to hardcode some items in the cart and a user access token in the user database to run some tests. Gonna work on that issue in the future to make it better

description: Unauthorized - User not authenticated. Please sign in
post:
tags:
- 'User'

Choose a reason for hiding this comment

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

I would have separated User actions like login with the Cart actions. In the future when your application is bigger, it wont be sustainable.

type: array
items:
$ref: '#/definitions/Brand'
/store/brands/{Id}/products:

Choose a reason for hiding this comment

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

make sure to use lowercase for id.

Suggested change
/store/brands/{Id}/products:
/store/brands/{id}/products:

name: product
required: true
schema:
type: object

Choose a reason for hiding this comment

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

you missed the body schema

Comment on lines +181 to +184
404:
description: Item not found or Item not in cart
400:
description: Quantity must be at least 1

Choose a reason for hiding this comment

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

this ones should also be in the DELETE api


describe('/store/brands/:id/products', () => {
it('should get a item based off of Id', (done) => {
let id = 1;

Choose a reason for hiding this comment

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

this is a const, not a let.

.get('/store/products')
.end((err, res) => {
res.should.have.status(200);
res.body.should.be.an('array');

Choose a reason for hiding this comment

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

this is not really testing anything as the array will be empty and the test will pass. If it was a real scenario and this request should be actually returning products, you will have serious bug in your application as it will be passing.

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