Skip to content

Instantly share code, notes, and snippets.

@christopherkade
Created April 2, 2019 07:07
Show Gist options
  • Select an option

  • Save christopherkade/9ba49ac11a822e01202245ab226d46fb to your computer and use it in GitHub Desktop.

Select an option

Save christopherkade/9ba49ac11a822e01202245ab226d46fb to your computer and use it in GitHub Desktop.
Unit testing example 01
// 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