From 4de41129fed8db38e6b59a44ccf270d59d929383 Mon Sep 17 00:00:00 2001 From: d-kimsuon Date: Sat, 18 Oct 2025 01:50:14 +0900 Subject: [PATCH] chore: adjust form styles --- .../core/events/services/fileWatcher.test.ts | 7 ++++ .../functions/parseGitBranchesOutput.test.ts | 13 +------ .../functions/parseGitCommitsOutput.test.ts | 34 +------------------ src/server/hono/initialize.test.ts | 20 +++++++---- 4 files changed, 22 insertions(+), 52 deletions(-) diff --git a/src/server/core/events/services/fileWatcher.test.ts b/src/server/core/events/services/fileWatcher.test.ts index 3226902..ce95b2c 100644 --- a/src/server/core/events/services/fileWatcher.test.ts +++ b/src/server/core/events/services/fileWatcher.test.ts @@ -1,3 +1,4 @@ +import { Path } from "@effect/platform"; import { Effect } from "effect"; import { describe, expect, it } from "vitest"; import type { InternalEventDeclaration } from "../types/InternalEventDeclaration"; @@ -21,6 +22,7 @@ describe("FileWatcherService", () => { program.pipe( Effect.provide(FileWatcherService.Live), Effect.provide(EventBus.Live), + Effect.provide(Path.layer), ), ); @@ -44,6 +46,7 @@ describe("FileWatcherService", () => { program.pipe( Effect.provide(FileWatcherService.Live), Effect.provide(EventBus.Live), + Effect.provide(Path.layer), ), ); @@ -67,6 +70,7 @@ describe("FileWatcherService", () => { program.pipe( Effect.provide(FileWatcherService.Live), Effect.provide(EventBus.Live), + Effect.provide(Path.layer), ), ); @@ -96,6 +100,7 @@ describe("FileWatcherService", () => { program.pipe( Effect.provide(FileWatcherService.Live), Effect.provide(EventBus.Live), + Effect.provide(Path.layer), ), ); @@ -142,6 +147,7 @@ describe("FileWatcherService", () => { program.pipe( Effect.provide(FileWatcherService.Live), Effect.provide(EventBus.Live), + Effect.provide(Path.layer), ), ); @@ -167,6 +173,7 @@ describe("FileWatcherService", () => { program.pipe( Effect.provide(FileWatcherService.Live), Effect.provide(EventBus.Live), + Effect.provide(Path.layer), ), ); diff --git a/src/server/core/git/functions/parseGitBranchesOutput.test.ts b/src/server/core/git/functions/parseGitBranchesOutput.test.ts index c3e9e42..33d8041 100644 --- a/src/server/core/git/functions/parseGitBranchesOutput.test.ts +++ b/src/server/core/git/functions/parseGitBranchesOutput.test.ts @@ -1,6 +1,5 @@ -import { describe, expect, it, vi } from "vitest"; +import { describe, expect, it } from "vitest"; import { parseGitBranchesOutput } from "./parseGitBranchesOutput"; -import * as utils from "./utils"; describe("getBranches", () => { describe("正常系", () => { @@ -74,11 +73,6 @@ describe("getBranches", () => { it("空の結果を返す(ブランチがない場合)", async () => { const mockOutput = ""; - vi.mocked(utils.executeGitCommand).mockResolvedValue({ - success: true, - data: mockOutput, - }); - const result = parseGitBranchesOutput(mockOutput); expect(result.success).toBe(true); @@ -92,11 +86,6 @@ describe("getBranches", () => { invalid line feature def5678 Feature commit`; - vi.mocked(utils.executeGitCommand).mockResolvedValue({ - success: true, - data: mockOutput, - }); - const result = parseGitBranchesOutput(mockOutput); expect(result.success).toBe(true); diff --git a/src/server/core/git/functions/parseGitCommitsOutput.test.ts b/src/server/core/git/functions/parseGitCommitsOutput.test.ts index 1d209a9..6e24ab2 100644 --- a/src/server/core/git/functions/parseGitCommitsOutput.test.ts +++ b/src/server/core/git/functions/parseGitCommitsOutput.test.ts @@ -1,6 +1,5 @@ -import { describe, expect, it, vi } from "vitest"; +import { describe, expect, it } from "vitest"; import { parseGitCommitsOutput } from "./parseGitCommitsOutput"; -import * as utils from "./utils"; describe("getCommits", () => { describe("正常系", () => { @@ -9,11 +8,6 @@ describe("getCommits", () => { def456|fix: bug fix|Jane Smith|2024-01-14 09:20:00 +0900 ghi789|chore: update deps|Bob Johnson|2024-01-13 08:10:00 +0900`; - vi.mocked(utils.executeGitCommand).mockResolvedValue({ - success: true, - data: mockOutput, - }); - const result = parseGitCommitsOutput(mockOutput); expect(result.success).toBe(true); @@ -42,12 +36,6 @@ ghi789|chore: update deps|Bob Johnson|2024-01-13 08:10:00 +0900`; it("空の結果を返す(コミットがない場合)", async () => { const mockOutput = ""; - - vi.mocked(utils.executeGitCommand).mockResolvedValue({ - success: true, - data: mockOutput, - }); - const result = parseGitCommitsOutput(mockOutput); expect(result.success).toBe(true); @@ -63,11 +51,6 @@ def456|fix: bug fix|Jane Smith|2024-01-14 09:20:00 +0900 ||missing data| ghi789|chore: update deps|Bob Johnson|2024-01-13 08:10:00 +0900`; - vi.mocked(utils.executeGitCommand).mockResolvedValue({ - success: true, - data: mockOutput, - }); - const result = parseGitCommitsOutput(mockOutput); expect(result.success).toBe(true); @@ -85,11 +68,6 @@ ghi789|chore: update deps|Bob Johnson|2024-01-13 08:10:00 +0900`; const mockOutput = `abc123|feat: add "quotes" & chars|Author Name|2024-01-15 10:30:00 +0900 def456|fix: 日本語メッセージ|日本語 著者|2024-01-14 09:20:00 +0900`; - vi.mocked(utils.executeGitCommand).mockResolvedValue({ - success: true, - data: mockOutput, - }); - const result = parseGitCommitsOutput(mockOutput); expect(result.success).toBe(true); @@ -106,11 +84,6 @@ def456|fix: 日本語メッセージ|日本語 著者|2024-01-14 09:20:00 +0900` it("空白を含むパスでも正常に動作する", async () => { const mockOutput = `abc123|feat: test|Author|2024-01-15 10:30:00 +0900`; - vi.mocked(utils.executeGitCommand).mockResolvedValue({ - success: true, - data: mockOutput, - }); - const result = parseGitCommitsOutput(mockOutput); expect(result.success).toBe(true); @@ -126,11 +99,6 @@ def456|fix: 日本語メッセージ|日本語 著者|2024-01-14 09:20:00 +0900` def456|fix: bug|Author|2024-01-14 09:20:00 +0900 `; - vi.mocked(utils.executeGitCommand).mockResolvedValue({ - success: true, - data: mockOutput, - }); - const result = parseGitCommitsOutput(mockOutput); expect(result.success).toBe(true); diff --git a/src/server/hono/initialize.test.ts b/src/server/hono/initialize.test.ts index f3ca36a..2778b9f 100644 --- a/src/server/hono/initialize.test.ts +++ b/src/server/hono/initialize.test.ts @@ -1,3 +1,4 @@ +import { Path } from "@effect/platform"; import { Effect, Layer, Ref } from "effect"; import { describe, expect, it, vi } from "vitest"; import { EventBus } from "../core/events/services/EventBus"; @@ -100,6 +101,7 @@ describe("InitializeService", () => { createMockProjectMetaService(), createMockSessionMetaService(), VirtualConversationDatabase.Live, + Path.layer, ); // Provide dependencies to InitializeService.Live and expose all services @@ -158,7 +160,7 @@ describe("InitializeService", () => { ); const result = await Effect.runPromise( - program.pipe(Effect.provide(testLayer)), + program.pipe(Effect.provide(testLayer), Effect.provide(Path.layer)), ); expect(result).toBeUndefined(); @@ -178,7 +180,7 @@ describe("InitializeService", () => { const testLayer = createTestLayer(); const result = await Effect.runPromise( - program.pipe(Effect.provide(testLayer)), + program.pipe(Effect.provide(testLayer), Effect.provide(Path.layer)), ); expect(result).toBe("file watcher started"); @@ -217,7 +219,7 @@ describe("InitializeService", () => { const testLayer = createTestLayer(); const result = await Effect.runPromise( - program.pipe(Effect.provide(testLayer)), + program.pipe(Effect.provide(testLayer), Effect.provide(Path.layer)), ); expect(result).toHaveLength(1); @@ -251,7 +253,7 @@ describe("InitializeService", () => { const testLayer = createTestLayer(); const result = await Effect.runPromise( - program.pipe(Effect.provide(testLayer)), + program.pipe(Effect.provide(testLayer), Effect.provide(Path.layer)), ); // heartbeat is emitted immediately once first, then every 10 seconds @@ -314,7 +316,9 @@ describe("InitializeService", () => { mockSessionRepositoryLayer, ); - await Effect.runPromise(program.pipe(Effect.provide(testLayer))); + await Effect.runPromise( + program.pipe(Effect.provide(testLayer), Effect.provide(Path.layer)), + ); expect(getProjectsCalled).toHaveBeenCalledTimes(1); expect(getSessionsCalled).toHaveBeenCalledTimes(1); @@ -336,7 +340,9 @@ describe("InitializeService", () => { // Completes without throwing error await expect( - Effect.runPromise(program.pipe(Effect.provide(testLayer))), + Effect.runPromise( + program.pipe(Effect.provide(testLayer), Effect.provide(Path.layer)), + ), ).resolves.toBeUndefined(); }); }); @@ -353,7 +359,7 @@ describe("InitializeService", () => { const testLayer = createTestLayer(); const result = await Effect.runPromise( - program.pipe(Effect.provide(testLayer)), + program.pipe(Effect.provide(testLayer), Effect.provide(Path.layer)), ); expect(result).toBe("cleaned up");