- [Instructor] So back in our server spec…let's fix our calculator test…and change it's to be to four.…Now let's describe another set of tests.…This time it'll be specific to get messages.…So all the test part of this group…will test various features…of our get messages endpoint.…So let's create our first test or specification.…It should return…200 ok.…So we expect that the status code…of get messages will be 200 ok…not 500 if there is a server error…not 401 for not found, etc…and then let's add a call back.…
So inside here we actually need to make an…HTTP get request.…Natively we can't do that so we'll have to use…a library called request.…So let's install that with npm install…- - save - dev…request…and at the top let's require it in.…
Then we'll use request.get…and we'll specify our URL…and then a call back.…The call back will contain an error…and the response.…For now we'll console log…the response to make sure we're actually getting a response.…
At this point we'll have to start our server…so we use nodemon…and it started our server.…
Author
Updated
4/5/2019Released
11/7/2017- Asynchronous tasks and callbacks
- Benefits and features of JavaScript
- Managing third-party packages with npm
- Node.js frameworks
- Static serving with Express
- Creating a browser app
- Exploring databases
- Saving data to MongoDB with Mongoose
- Error handling and debugging
- Simple tests and async tests
Skill Level Beginner
Duration
Views
-
Introduction
-
Welcome41s
-
-
1. Introduction to Node
-
Download and install Node1m 28s
-
2. Understanding npm: Node Package Manager
-
Write your own module2m 18s
-
-
3. Reading and Writing Files
-
Read from files4m 31s
-
Access directories1m 6s
-
Write to a file2m 46s
-
-
4. Exploring Web Frameworks
-
Node.js frameworks1m 23s
-
Express1m 6s
-
Socket.io55s
-
-
5. Building Your Demo App Chat Client for the Browser
-
Static serving with Express5m 30s
-
Create your browser app8m 43s
-
Create your Socket.io event1m 59s
-
-
6. Exploring Databases
-
Types of data frameworks2m 2s
-
Set up MongoDB1m 46s
-
Mongoose2m 59s
-
-
7. Improving Asynchronous Code
-
Nested callbacks3m 27s
-
Promises7m 14s
-
Async/await2m 44s
-
-
8. Error Handling and Debugging
-
Try/catch2m 6s
-
Finally1m 40s
-
Editor debugging4m 14s
-
-
9. Testing
-
Simple test with Jasmine4m 33s
-
Async test with Jasmine5m 33s
-
-
Conclusion
-
Next steps1m 24s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Async test with Jasmine