feat: Add testing framework and initial test cases for various tools and database operations

This commit is contained in:
ethan.chen
2026-01-07 10:05:04 +08:00
parent 372b52b214
commit 47ecc40186
23 changed files with 1781 additions and 40 deletions

66
tests/fixtures/test-data.ts vendored Normal file
View File

@@ -0,0 +1,66 @@
/**
* Test data fixtures
*/
import {
CodeSnippet,
Note,
Task,
BabyMilestone,
MathResource,
GameWishlist,
} from "../../src/storage/database.js";
export const testCodeSnippet: CodeSnippet = {
id: "test-snippet-1",
title: "Test Snippet",
code: "const x = 1;",
language: "typescript",
tags: ["test", "example"],
category: "utils",
createdAt: "2024-01-01T00:00:00.000Z",
updatedAt: "2024-01-01T00:00:00.000Z",
};
export const testNote: Note = {
id: "test-note-1",
title: "Test Note",
content: "This is a test note",
tags: ["test"],
createdAt: "2024-01-01T00:00:00.000Z",
updatedAt: "2024-01-01T00:00:00.000Z",
};
export const testTask: Task = {
id: "test-task-1",
title: "Test Task",
description: "This is a test task",
completed: false,
createdAt: "2024-01-01T00:00:00.000Z",
};
export const testBabyMilestone: BabyMilestone = {
id: "test-milestone-1",
title: "First Steps",
description: "Baby took first steps",
date: "2024-01-01",
createdAt: "2024-01-01T00:00:00.000Z",
};
export const testMathResource: MathResource = {
id: "test-math-1",
title: "Addition Problems",
content: "1 + 1 = 2",
grade: "1st",
difficulty: "easy",
tags: ["addition"],
createdAt: "2024-01-01T00:00:00.000Z",
};
export const testGameWishlist: GameWishlist = {
id: "test-game-1",
gameName: "Test Game",
platform: "PC",
notes: "Want to play this",
addedAt: "2024-01-01T00:00:00.000Z",
};