Created
September 10, 2019 08:38
-
-
Save stevgouws/4b758e7fe3af59d5eb618b427c48a05a to your computer and use it in GitHub Desktop.
Boundary Analysis and Equivalence Class Testing Example
This file contains 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
function isMinor(age) { | |
return age >= 0 && age < 18 | |
} | |
describe("isMinor", () => { | |
it("should return true for any value between 0 and 18", () => { | |
expect(isMinor(10)).toEqual(true); | |
}); | |
it("should return true for 0", () => { | |
expect(isMinor(0)).toEqual(true); | |
}); | |
it("should return false for anything less than 0", () => { | |
expect(isMinor(-1).toEqual(false); | |
}); | |
it("should return true for 17", () => { | |
expect(isMinor(17)).toEqual(true); | |
}); | |
it("should return false for anything above 17", () => { | |
expect(isMinor(18)).toEqual(false); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment