test: dedupe and optimize test suites

This commit is contained in:
Peter Steinberger
2026-02-19 15:18:50 +00:00
parent b0e55283d5
commit a1cb700a05
80 changed files with 2627 additions and 2962 deletions

View File

@@ -36,18 +36,10 @@ describe("createEditorSubmitHandler", () => {
expect(editor.addToHistory).toHaveBeenCalledWith("hi");
});
it("does not add empty-string submissions to history", () => {
it.each(["", " "])("does not add blank submissions to history", (text) => {
const { editor, handler } = createSubmitHarness();
handler("");
expect(editor.addToHistory).not.toHaveBeenCalled();
});
it("does not add whitespace-only submissions to history", () => {
const { editor, handler } = createSubmitHarness();
handler(" ");
handler(text);
expect(editor.addToHistory).not.toHaveBeenCalled();
});
@@ -79,12 +71,4 @@ describe("createEditorSubmitHandler", () => {
expect(handleBangLine).toHaveBeenCalledWith("!ls");
});
it("treats a lone ! as a normal message", () => {
const { sendMessage, handler } = createSubmitHarness();
handler("!");
expect(sendMessage).toHaveBeenCalledWith("!");
});
});