mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Refactor Git to accept a nostr object
This commit is contained in:
16 files changed
+184
-379
No files matched your search
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user