Refactor Git to accept a nostr object

This commit is contained in:
Alex Gleason committed 2025-09-21 14:31:13 -05:00
1 parent f797ec55c5
commit 69c1000063
16 files changed
+184 -379

No files matched your search

+14 -1
View File
@@ -2,6 +2,7 @@ import { describe, it, expect, beforeEach, vi } from 'vitest';
import { ShellTool } from './ShellTool';
import { Git } from '../git';
import type { JSRuntimeFS } from '../JSRuntime';
import { NPool } from '@nostrify/nostrify';
// Mock filesystem
const createMockFS = (): JSRuntimeFS => ({
@@ -18,15 +19,27 @@ const createMockFS = (): JSRuntimeFS => ({
symlink: vi.fn(),
});
const createMockNostr = (): NPool => ({
req: vi.fn(),
query: vi.fn(),
event: vi.fn(),
group: vi.fn(),
relay: vi.fn(),
relays: new Map(),
close: vi.fn(),
}) as unknown as NPool;
describe('ShellTool', () => {
let mockFS: JSRuntimeFS;
let mockGit: Git;
let mockNostr: NPool;
let shellTool: ShellTool;
const testCwd = '/test/dir';
beforeEach(() => {
mockFS = createMockFS();
mockGit = new Git(mockFS);
mockNostr = createMockNostr();
mockGit = new Git({ fs: mockFS, nostr: mockNostr });
shellTool = new ShellTool(mockFS, testCwd, mockGit);
});