-
Notifications
You must be signed in to change notification settings - Fork 606
Added week1 homework tests and updated documentation #128
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
Conversation
I will give your homework week 1 a try using the instructions you provided and then give you feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to have tests in here.
Just a couple of suggestions.
|
||
## Run the project | ||
|
||
In `week1/homework` run: | ||
|
||
```bash | ||
node . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify between using node .
and running the tests:
You can interactively test the endpoints with the browser or by using PostMan.
Before submitting your homework via pull request, make sure that your server passes all the unit tests as describe above.
week1/homework/README.md
Outdated
Pay extra attention to line 21, which contains some hints for this week | ||
`console.log('New http request received', request.url);` | ||
call `state`. Use project in `week1/lecture` directory for reference. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your modifications should be limited to the src
folder. Do not make any changes to the test
folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense. Should have added that.
week1/homework/test/server.test.js
Outdated
|
||
expect(parsed).toEqual({ | ||
state | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you also want to test for Content-Type application/json
in the response header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
week1/homework/src/index.js
Outdated
|
||
const PORT = 3000; | ||
|
||
createServer(PORT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it useful to have some feedback when the server is started:
createServer(PORT)
.then(() => {
console.log('server listening on port', PORT);
});
week1/homework/README.md
Outdated
call `state`. Use project in `week1` directory as starting material. | ||
Pay extra attention to line 21, which contains some hints for this week | ||
`console.log('New http request received', request.url);` | ||
call `state`. Use project in `week1/lecture` directory for reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the project...
d83c272
to
1a8ff37
Compare
Re-ran the tests on my "homework", forcing errors incl. content-type. All fine! Good work! |
Might not be the best way to do it so work in progress.