Skip to content

Instantly share code, notes, and snippets.

@ericelliott
Last active May 17, 2022 15:32
Show Gist options
  • Save ericelliott/bc4c0fb66973202f6680 to your computer and use it in GitHub Desktop.
Save ericelliott/bc4c0fb66973202f6680 to your computer and use it in GitHub Desktop.
Anatomy of a Unit Test
import test from 'tape';
// For each unit test you write,
// answer these questions:
test('What component aspect are you testing?', assert => {
const actual = 'What is the actual output?';
const expected = 'What is the expected output?';
assert.equal(actual, expected,
'What should the feature do?');
assert.end();
});
@terkelg
Copy link

terkelg commented Jul 27, 2016

Thanks, Super helpful!
For those who didn't come here directly from the article, you should check it out:
5 Questions Every Unit Test Must Answer
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment