Created
April 2, 2019 07:07
-
-
Save christopherkade/9ba49ac11a822e01202245ab226d46fb to your computer and use it in GitHub Desktop.
Unit testing example 01
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
| // 1. The method we want to test | |
| function add(x, y) { | |
| return x + y | |
| } | |
| // 2. A test suite | |
| describe("add method", () => { | |
| // 3. A unit test | |
| it("should return 2", () => { | |
| // 4. An assertion | |
| expect(add(1, 1)).toBe(2) | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment