Audit a suite
Here is a module and a suite somebody else wrote for it. Read them, decide how much of the module’s behaviour this suite actually pins down, and commit to a number. Then run the board.
The module — One or many
| 1 | export function label(count) { | |
| 2 | if (count > 1) { | |
| 3 | return "many"; | |
| 4 | } | |
| 5 | return "one"; | |
| 6 | } | |
| 7 |
The suite under review
describe("label", () => {
test("handles a plural count", () => {
expect(() => label(5)).not.toThrow();
});
test("handles a single item", () => {
expect(() => label(1)).not.toThrow();
});
test("handles none", () => {
expect(() => label(0)).not.toThrow();
});
});
Your estimate
What share of the killable changes to that module do you think this suite would catch?
70%
Worth asking as you read: does each test assert on a value, or on a shape, a type, or the absence of an exception? Are the inputs interesting? Does anything exercise the error path?