File tree Expand file tree Collapse file tree 4 files changed +68
-24
lines changed
Expand file tree Collapse file tree 4 files changed +68
-24
lines changed Original file line number Diff line number Diff line change @@ -8,39 +8,18 @@ import * as os from "node:os";
88import { execSync } from "node:child_process" ;
99import { FileStorage } from "../core/storage/index.js" ;
1010
11- import type { ArchivedTask } from "../types.js" ;
12-
1311// Re-export shared test utilities from test-utils
1412export {
1513 setupGitHubMock ,
1614 cleanupGitHubMock ,
1715 createIssueFixture ,
1816 createTask ,
1917 createStore ,
18+ createArchivedTask ,
2019 type GitHubIssueFixture ,
2120 type GitHubMock ,
2221} from "../test-utils/github-mock.js" ;
2322
24- /**
25- * Create an ArchivedTask with sensible defaults for testing.
26- */
27- export function createArchivedTask (
28- overrides : Partial < ArchivedTask > = { } ,
29- ) : ArchivedTask {
30- return {
31- id : "test-id" ,
32- parent_id : null ,
33- name : "Test archived task" ,
34- description : "" ,
35- result : null ,
36- completed_at : null ,
37- archived_at : new Date ( ) . toISOString ( ) ,
38- metadata : null ,
39- archived_children : [ ] ,
40- ...overrides ,
41- } ;
42- }
43-
4423// ============ CLI-specific utilities ============
4524
4625// Task IDs are 8 lowercase alphanumeric characters
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import * as fs from "node:fs";
33import * as path from "node:path" ;
44import * as os from "node:os" ;
55import { ArchiveStorage } from "./archive-storage.js" ;
6- import { createArchivedTask } from "../../cli/ test-helpers .js" ;
6+ import { createArchivedTask } from "../../test-utils/index .js" ;
77import type { ArchivedTask } from "../../types.js" ;
88
99describe ( "ArchiveStorage" , ( ) => {
Original file line number Diff line number Diff line change 44 */
55
66import nock from "nock" ;
7- import type { Task , TaskStore } from "../types.js" ;
7+ import type { ArchivedTask , Task , TaskStore } from "../types.js" ;
88
99// ============ GitHub API Mocking ============
1010
@@ -359,3 +359,23 @@ export function createTask(overrides: Partial<Task> = {}): Task {
359359export function createStore ( tasks : Task [ ] = [ ] ) : TaskStore {
360360 return { tasks } ;
361361}
362+
363+ /**
364+ * Create an ArchivedTask with sensible defaults for testing.
365+ */
366+ export function createArchivedTask (
367+ overrides : Partial < ArchivedTask > = { } ,
368+ ) : ArchivedTask {
369+ return {
370+ id : "test-id" ,
371+ parent_id : null ,
372+ name : "Test archived task" ,
373+ description : "" ,
374+ result : null ,
375+ completed_at : null ,
376+ archived_at : new Date ( ) . toISOString ( ) ,
377+ metadata : null ,
378+ archived_children : [ ] ,
379+ ...overrides ,
380+ } ;
381+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * Unified test utilities for all dex tests.
3+ *
4+ * This module re-exports all shared test utilities from a single location.
5+ * Import from here for general test utilities:
6+ *
7+ * import { createTask, testEnv, setupGitHubMock } from "../test-utils/index.js";
8+ *
9+ * For domain-specific test utilities, use the specialized modules:
10+ * - CLI tests: import from "../cli/test-helpers.js"
11+ * - MCP tests: import from "../mcp/test-helpers.js"
12+ */
13+
14+ // Test environment setup
15+ export {
16+ testEnv ,
17+ initTestEnv ,
18+ cleanupTestEnv ,
19+ type TestEnv ,
20+ } from "./test-env.js" ;
21+
22+ // Vitest re-exports for convenience
23+ export {
24+ describe ,
25+ it ,
26+ test ,
27+ expect ,
28+ beforeEach ,
29+ afterEach ,
30+ beforeAll ,
31+ afterAll ,
32+ vi ,
33+ } from "./test-env.js" ;
34+
35+ // GitHub API mocking and task fixtures
36+ export {
37+ setupGitHubMock ,
38+ cleanupGitHubMock ,
39+ createIssueFixture ,
40+ createTask ,
41+ createStore ,
42+ createArchivedTask ,
43+ type GitHubIssueFixture ,
44+ type GitHubMock ,
45+ } from "./github-mock.js" ;
You can’t perform that action at this time.
0 commit comments