Skip to content

Instantly share code, notes, and snippets.

@wolframkriesing
Created November 23, 2017 11:41
Show Gist options
  • Save wolframkriesing/7f86e01b799926e5b0d49b442bf1c1d8 to your computer and use it in GitHub Desktop.
Save wolframkriesing/7f86e01b799926e5b0d49b442bf1c1d8 to your computer and use it in GitHub Desktop.
const tap = require('tap');
const test = tap.test;
function findImageDimensions() {
return {width: 100, height: 100};
}
// this FAILS
test('Find image dimensions', (t) => {
t.test('if requested size matches, return it', (t) => {
const dimensions = findImageDimensions();
t.same(dimensions, {width: 100, height: 100});
});
});
// this PASSES
test('Find image dimensions', (t) => {
t.test('if requested size matches, return it', (t) => {
const dimensions = findImageDimensions();
t.same(dimensions, {width: 100, height: 100});
t.end();
});
t.end();
});
// though the docs say "there is no need to call tap.end() explicitly"
// http://www.node-tap.org/api/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment