Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 2 commits into from
Apr 4, 2018
Merged

Conversation

GeorgeSapkin
Copy link
Member

Might not be the best way to do it so work in progress.

@remarcmij
Copy link
Contributor

I will give your homework week 1 a try using the instructions you provided and then give you feedback.

Copy link
Contributor

@remarcmij remarcmij left a 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 .
Copy link
Contributor

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.

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.

Copy link
Contributor

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.

Copy link
Member Author

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.


expect(parsed).toEqual({
state
});
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea.


const PORT = 3000;

createServer(PORT);
Copy link
Contributor

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);
  });

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the project...

@GeorgeSapkin GeorgeSapkin force-pushed the testing branch 2 times, most recently from d83c272 to 1a8ff37 Compare April 3, 2018 22:48
@remarcmij
Copy link
Contributor

Re-ran the tests on my "homework", forcing errors incl. content-type. All fine! Good work!

@GeorgeSapkin GeorgeSapkin merged commit d3fe68b into master Apr 4, 2018
@GeorgeSapkin GeorgeSapkin deleted the testing branch April 4, 2018 09:33
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