|
4 | 4 | * These tests verify that createSourceFromState correctly uses resolvedRef |
5 | 5 | * from state metadata when creating source instances. |
6 | 6 | * |
7 | | - * The tests mock the source modules to capture what config gets passed |
| 7 | + * We mock GitHub and Website sources to capture what config gets passed |
8 | 8 | * to the constructors, without needing API credentials. |
| 9 | + * |
| 10 | + * Since all VCS sources (GitHub, GitLab, BitBucket) use the same getRef() logic, |
| 11 | + * we only test GitHub as the representative case. |
9 | 12 | */ |
10 | 13 |
|
11 | 14 | import { describe, it, expect, vi, beforeEach } from "vitest"; |
12 | 15 | import type { IndexStateSearchOnly, SourceMetadata } from "../core/types.js"; |
13 | 16 |
|
14 | | -// Mock the source modules to capture constructor calls |
| 17 | +// Mock only the sources we actually test |
15 | 18 | vi.mock("../sources/github.js", () => ({ |
16 | 19 | GitHubSource: vi.fn().mockImplementation((config) => ({ |
17 | 20 | type: "github" as const, |
18 | 21 | config, |
19 | 22 | })), |
20 | 23 | })); |
21 | 24 |
|
22 | | -vi.mock("../sources/gitlab.js", () => ({ |
23 | | - GitLabSource: vi.fn().mockImplementation((config) => ({ |
24 | | - type: "gitlab" as const, |
25 | | - config, |
26 | | - })), |
27 | | -})); |
28 | | - |
29 | | -vi.mock("../sources/bitbucket.js", () => ({ |
30 | | - BitBucketSource: vi.fn().mockImplementation((config) => ({ |
31 | | - type: "bitbucket" as const, |
32 | | - config, |
33 | | - })), |
34 | | -})); |
35 | | - |
36 | 25 | vi.mock("../sources/website.js", () => ({ |
37 | 26 | WebsiteSource: vi.fn().mockImplementation((config) => ({ |
38 | 27 | type: "website" as const, |
|
0 commit comments