Fix browser VCS status test mocks
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
2cffe6742e
commit
547c0e5809
2 files changed
+64
-12
No files matched your search
@@ -65,12 +65,38 @@ import { BrowserWsRpcHarness, type NormalizedWsRpcRequestBody } from "../../test
|
||||
|
||||
import { DEFAULT_CLIENT_SETTINGS } from "@t3tools/contracts/settings";
|
||||
|
||||
vi.mock("../lib/vcsStatusState", () => ({
|
||||
useVcsStatus: () => ({ data: null, error: null, cause: null, isPending: false }),
|
||||
useVcsStatuses: () => new Map(),
|
||||
refreshVcsStatus: () => Promise.resolve(null),
|
||||
resetVcsStatusStateForTests: () => undefined,
|
||||
}));
|
||||
vi.mock("../lib/vcsStatusState", () => {
|
||||
const status = {
|
||||
data: {
|
||||
isRepo: true,
|
||||
sourceControlProvider: {
|
||||
kind: "github",
|
||||
name: "GitHub",
|
||||
baseUrl: "https://github.com",
|
||||
},
|
||||
hasPrimaryRemote: true,
|
||||
isDefaultRef: true,
|
||||
refName: "main",
|
||||
hasWorkingTreeChanges: false,
|
||||
workingTree: { files: [], insertions: 0, deletions: 0 },
|
||||
hasUpstream: true,
|
||||
aheadCount: 0,
|
||||
behindCount: 0,
|
||||
pr: null,
|
||||
},
|
||||
error: null,
|
||||
cause: null,
|
||||
isPending: false,
|
||||
};
|
||||
|
||||
return {
|
||||
getVcsStatusSnapshot: () => status,
|
||||
useVcsStatus: () => status,
|
||||
useVcsStatuses: () => new Map(),
|
||||
refreshVcsStatus: () => Promise.resolve(null),
|
||||
resetVcsStatusStateForTests: () => undefined,
|
||||
};
|
||||
});
|
||||
|
||||
const THREAD_ID = "thread-browser-test" as ThreadId;
|
||||
const THREAD_TITLE = "Browser test thread";
|
||||
|
||||
@@ -33,12 +33,38 @@ import { useStore } from "../store";
|
||||
import { createAuthenticatedSessionHandlers } from "../../test/authHttpHandlers";
|
||||
import { BrowserWsRpcHarness } from "../../test/wsRpcHarness";
|
||||
|
||||
vi.mock("../lib/vcsStatusState", () => ({
|
||||
useVcsStatus: () => ({ data: null, error: null, cause: null, isPending: false }),
|
||||
useVcsStatuses: () => new Map(),
|
||||
refreshVcsStatus: () => Promise.resolve(null),
|
||||
resetVcsStatusStateForTests: () => undefined,
|
||||
}));
|
||||
vi.mock("../lib/vcsStatusState", () => {
|
||||
const status = {
|
||||
data: {
|
||||
isRepo: true,
|
||||
sourceControlProvider: {
|
||||
kind: "github",
|
||||
name: "GitHub",
|
||||
baseUrl: "https://github.com",
|
||||
},
|
||||
hasPrimaryRemote: true,
|
||||
isDefaultRef: true,
|
||||
refName: "main",
|
||||
hasWorkingTreeChanges: false,
|
||||
workingTree: { files: [], insertions: 0, deletions: 0 },
|
||||
hasUpstream: true,
|
||||
aheadCount: 0,
|
||||
behindCount: 0,
|
||||
pr: null,
|
||||
},
|
||||
error: null,
|
||||
cause: null,
|
||||
isPending: false,
|
||||
};
|
||||
|
||||
return {
|
||||
getVcsStatusSnapshot: () => status,
|
||||
useVcsStatus: () => status,
|
||||
useVcsStatuses: () => new Map(),
|
||||
refreshVcsStatus: () => Promise.resolve(null),
|
||||
resetVcsStatusStateForTests: () => undefined,
|
||||
};
|
||||
});
|
||||
|
||||
const THREAD_ID = "thread-kb-toast-test" as ThreadId;
|
||||
const PROJECT_ID = "project-1" as ProjectId;
|
||||
|
||||
Reference in new issue
Block a user