mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-27 23:06:54 +05:00
feat(ipuaro): implement v0.1.0 foundation
- Project setup with tsup, vitest, ESM support - Domain entities: Session, Project - Value objects: FileData, FileAST, FileMeta, ChatMessage, ToolCall, ToolResult, UndoEntry - Service interfaces: IStorage, ILLMClient, ITool, IIndexer, IToolRegistry - Shared: Config (zod), IpuaroError, utils (hash, tokens), Result type - CLI with placeholder commands (start, init, index) - 91 unit tests with 100% coverage - Fix package scope @puaros -> @samiyev in CLAUDE.md
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import {
|
||||
createFileData,
|
||||
isFileDataEqual,
|
||||
} from "../../../../src/domain/value-objects/FileData.js"
|
||||
|
||||
describe("FileData", () => {
|
||||
describe("createFileData", () => {
|
||||
it("should create FileData with all fields", () => {
|
||||
const lines = ["line1", "line2"]
|
||||
const hash = "abc123"
|
||||
const size = 100
|
||||
const lastModified = Date.now()
|
||||
|
||||
const result = createFileData(lines, hash, size, lastModified)
|
||||
|
||||
expect(result.lines).toEqual(lines)
|
||||
expect(result.hash).toBe(hash)
|
||||
expect(result.size).toBe(size)
|
||||
expect(result.lastModified).toBe(lastModified)
|
||||
})
|
||||
})
|
||||
|
||||
describe("isFileDataEqual", () => {
|
||||
it("should return true for equal hashes", () => {
|
||||
const a = createFileData(["a"], "hash1", 1, 1)
|
||||
const b = createFileData(["b"], "hash1", 2, 2)
|
||||
|
||||
expect(isFileDataEqual(a, b)).toBe(true)
|
||||
})
|
||||
|
||||
it("should return false for different hashes", () => {
|
||||
const a = createFileData(["a"], "hash1", 1, 1)
|
||||
const b = createFileData(["a"], "hash2", 1, 1)
|
||||
|
||||
expect(isFileDataEqual(a, b)).toBe(false)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user