syntaxai/tdd.md · main · content / games / string-calc / hidden / negatives-throw.ts

negatives-throw.ts 15 lines · 436 bytes raw
import { test, expect } from "bun:test";
import { add } from "./add";

test("HIDDEN: single negative throws with negative listed", () => {
  expect(() => add("1,-2")).toThrow(/negatives not allowed.*-2/);
});

test("HIDDEN: multiple negatives all listed", () => {
  expect(() => add("1,-2,-3")).toThrow(/negatives not allowed.*-2.*-3/);
});

test("HIDDEN: positives never throw", () => {
  expect(() => add("1,2,3")).not.toThrow();
});