Last active
September 18, 2022 08:00
-
-
Save aaditkamat/0b580a4ebcc9a7abca2badb788d6d5dc to your computer and use it in GitHub Desktop.
Unit testing with Jest and React Testing Library
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
beforeAll(() => { | |
console.log("This statement will get executed before all the test cases"); | |
}); | |
afterAll(() => { | |
console.log("This statement will get executed after all the test cases"); | |
}); | |
describe("test suite", () => { | |
beforeEach(() => { | |
console.log("This statement will get executed before each test case"); | |
}); | |
afterEach(() => { | |
console.log("This statement will get executed after each test case"); | |
}); | |
it("first test", () => { | |
expect(1).toBe(1); | |
}); | |
// alternative to it | |
test("second test", () => { | |
expect(1).not.toBe(2); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment