Clarkio Live Stream Notes: Setting up and writing tests in Node.js/JavaScript
Tags: javascript, webdev, node, twitch
Published: 2019-06-03 17:45:48

---
title: Clarkio Live Stream Notes: Setting up and writing tests in Node.js/JavaScript
published: true
description: Live stream recap notes from Clarkio's Twitch channel on May 29, 2019
tags: javascript,webdev,node,twitch
cover_image: https://user-images.githubusercontent.com/6265396/58821838-f5e59b00-8603-11e9-83ea-5887e987115f.png
canonical_url: https://www.clarkio.com/stream/2019-05-29
series: clarkio-live
---

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

- [Twitch](https://www.twitch.tv/videos/431564934)
- [YouTube](https://youtu.be/QvhNuHaCIN4?t=466)

## 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](https://yata.now.sh/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](https://github.com/clarkio/stream-note-taker)

## 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](https://twitch.tv/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](https://marketplace.visualstudio.com/items?itemName=MichaelJolley.vscode-twitch-themer&WT.mc_id=twitch-social-brcl) 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](https://twitch.tv/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](https://help.twitch.tv/s/article/how-to-use-clips) for more details. The following are some fun moments captured from this stream:

- [All my code are belong to...](https://clips.twitch.tv/ObliviousFineBobaNotLikeThis) `by` [@theMichaelJolley](https://twitch.tv/theMichaelJolley)

## Idea's Sparked by Today's Stream

- ([@dot_commie](https://twitch.tv/dot_commie)) 7D's DaReview rename to Discuss


## Get Connected with Clarkio

- [Twitter](https://twitter.com/_clarkio)
- [Twitch](https://twitch.tv/clarkio)
- [Instagram](https://instagram.com/_clarkio)
- [YouTube](https://youtube.com/clarkio)
- [GitHub](https://github.com/clarkio)
- [Website](https://www.clarkio.com)