feat: add unknown status and priority, change todo status to open

This commit is contained in:
2026-07-18 07:48:11 +05:00
parent 526a001d06
commit 148ed75841
28 changed files with 162 additions and 111 deletions
+9 -7
View File
@@ -1,6 +1,8 @@
import { Task } from "@/model/task";
import { ITaskRepository } from "@/ports";
import { TASK_FILE_EXTENSION } from "@/model/taskFile";
import { TaskPriority } from "@/model/taskPriority";
import { TaskStatus } from "@/model/taskStatus";
import { beforeEach, describe, expect, it } from "vitest";
import { InMemoryFileSystem } from "../../tests/helpers/InMemoryFileSystem";
import { FsTaskRepository } from "./FsTaskRepository";
@@ -21,8 +23,8 @@ describe("FsTaskRepository", () => {
const sampleTask = {
title: "Fix login bug",
description: "Token validation error",
status: "todo" as const,
priority: "high" as const,
status: TaskStatus.OPEN,
priority: TaskPriority.HIGH,
tags: ["bug", "frontend"],
assignee: "ivanov",
};
@@ -53,7 +55,7 @@ describe("FsTaskRepository", () => {
`${folder}/fix-login-bug${TASK_FILE_EXTENSION}`,
);
expect(content).toContain("Fix login bug");
expect(content).toContain("status: todo");
expect(content).toContain("status: open");
});
it("list returns created tasks sorted by updated desc", async () => {
@@ -81,12 +83,12 @@ describe("FsTaskRepository", () => {
it("update modifies fields and bumps updated timestamp", async () => {
const task = await repo.create(folder, sampleTask);
const updated: Task = { ...task, status: "done" };
const updated: Task = { ...task, status: TaskStatus.DONE };
await repo.update(folder, updated);
const found = await repo.getById(folder, task.id);
expect(found!.status).toBe("done");
expect(found!.status).toBe(TaskStatus.DONE);
expect(found!.title).toBe(task.title);
expect(found!.updated).toBe(t1);
expect(found!.created).toBe(t0);
@@ -220,7 +222,7 @@ describe("FsTaskRepository", () => {
});
it("creates task with tags containing special characters", async () => {
const task = await repo.create(folder, {
await repo.create(folder, {
...sampleTask,
tags: ["c#", "c++", "tag name", "tag:value"],
});
@@ -236,7 +238,7 @@ describe("FsTaskRepository", () => {
});
it("getFilePath produces consistent slug regardless of special characters", async () => {
const task = await repo.create(folder, {
await repo.create(folder, {
...sampleTask,
title: "Fix___bug...",
});