DEV Community

Cover image for Clarkio Live Stream Notes: Setting up and writing tests in Node.js/JavaScript
Brian Clark 💡
Brian Clark 💡

Posted on • Originally published at clarkio.com

Clarkio Live Stream Notes: Setting up and writing tests in Node.js/JavaScript

The following are notes and details recapping a past live stream where we live code together. The idea behind these streams is that they provide real-world examples of running into problems and solving them or working towards solving them live.

Wednesday - May 29, 2019

Stream Replay

Goals

✔ Chair appearance
✔ Set up machine to start testing (git pull note taker project)
✔ Bower appearance
✔ Talk about 7 D's and definition of done
✔ Testing, testing and more testing
✔ Achieve 100% test coverage for data.js file
✔ nock npm package: HTTP server mocking and expectations library for Node.js
✔ Closing and raid @davidortinau

Results

  • Successfully set up our local machine for testing Node.js
  • Added more tests and therefore better coverage to the stream note taker project

Next Steps

  • Rethink the approach in determining when a stream goes offline such as through the webhooks options from Twitch

Things we learned

  • How to set up our local environment to write tests for Node.js
  • Defining "Done" when it comes to code tasks
  • What's a "stub" and a "spy" when it comes to testing
  • Writing code in a way that's more testable
  • Testing tools: mocha, chai, sinon, supertest, istanbul/nyc, nock

Things to Review & Notes

  • (@pixelprodotco) consider writing an event log to disk in case of process failures or something.

Segments

Timestamp Topic
00:07:46 Kick it off
00:36:41 Noticing the VS Code themer extension is running
00:47:25 I spill coffee on my desk and keyboard
00:47:40 First Chair appearance
00:50:57 Set up our local development environment for testing
01:00:00 First Bower appearance
01:20:20 My four stages of developer testing
01:22:00 Defining when code tasks are done: 7 D's
01:34:20 Back to writing tests in the project
02:40:00 Achieved 100% test coverage for data.js file
02:47:00 Another Chair appearance
03:01:00 What's the nock npm package: HTTP server mocking and expectations library for Node.js
04:28:25 Closing and raid @davidortinau

Clips

Clips are a feature on Twitch that let you cut and capture segments of the live stream in the moment (up to 60 seconds). See how to use clips on Twitch for more details. The following are some fun moments captured from this stream:

Idea's Sparked by Today's Stream

Get Connected with Clarkio

Discussion (0)