sdlc-hub/web/src/api/closed.test.ts
2026-10-17 11:37:14 +04:00

26 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { describe, expect, it } from "vitest";
import { closedStatuses, isClosed } from "./closed.ts";
describe("закрытые статусы", () => {
const set = closedStatuses({ closed_statuses: ["Готово", "Снято"] });
it("набор — из closed_statuses настроек", () => {
expect([...set]).toEqual(["Готово", "Снято"]);
});
it("нет настройки или она не список — ничего не закрыто", () => {
expect(closedStatuses({}).size).toBe(0);
expect(closedStatuses(undefined).size).toBe(0);
expect(closedStatuses({ closed_statuses: "Готово" }).size).toBe(0);
expect([...closedStatuses({ closed_statuses: ["Готово", 5] })]).toEqual(["Готово"]);
});
it("закрыта — только задача со статусом из набора", () => {
expect(isClosed("Снято", set)).toBe(true);
expect(isClosed("В работе", set)).toBe(false);
expect(isClosed("", set)).toBe(false);
expect(isClosed(null, set)).toBe(false);
expect(isClosed(undefined, set)).toBe(false);
});
});