Created
October 3, 2016 13:13
-
-
Save ianp/0e44151b16718ebc83bb25efb68a9395 to your computer and use it in GitHub Desktop.
The simplest Jest example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "foo", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "jest" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"jest": "^16.0.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (a, b) => a + b | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sum = require('./sum') | |
test('adds 1 + 2 to equal 3', () => { | |
expect(sum(1, 2)).toBe(3) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment