test(FN-4783): stabilize workspace test lanes for verification
Fusion-Task-Id: FN-4783 Fusion-Task-Lineage: 7a02897b-e303-4947-86b2-3dd7a343f653
This commit is contained in:
committed by
gsxdsm
parent
3c272cda63
commit
415cd6a111
@@ -296,11 +296,15 @@ describe("bin command routing and fallbacks", () => {
|
|||||||
expect(output).toContain("worktrunk.onFailure");
|
expect(output).toContain("worktrunk.onFailure");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("launches dashboard when no args are provided", async () => {
|
it(
|
||||||
commandMocks.runDashboard.mockResolvedValue({ dispose: vi.fn() });
|
"launches dashboard when no args are provided",
|
||||||
await runBin([]);
|
async () => {
|
||||||
expect(commandMocks.runDashboard).toHaveBeenCalled();
|
commandMocks.runDashboard.mockResolvedValue({ dispose: vi.fn() });
|
||||||
});
|
await runBin([]);
|
||||||
|
expect(commandMocks.runDashboard).toHaveBeenCalled();
|
||||||
|
},
|
||||||
|
15000,
|
||||||
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
"prints an error for unknown top-level command",
|
"prints an error for unknown top-level command",
|
||||||
|
|||||||
@@ -128,22 +128,29 @@ describe("test-project fixture", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("cleans up auto-created temp dirs when setup fails before returning a fixture", async () => {
|
it("cleans up auto-created temp dirs when setup fails before returning a fixture", async () => {
|
||||||
|
const projectPrefix = `fusion-test-project-failure-${Date.now()}-`;
|
||||||
|
const globalPrefix = `fusion-test-global-failure-${Date.now()}-`;
|
||||||
const countTmpDirs = (prefix: string) =>
|
const countTmpDirs = (prefix: string) =>
|
||||||
readdirSync(tmpdir()).filter((entry) => entry.startsWith(prefix)).length;
|
readdirSync(tmpdir()).filter((entry) => entry.startsWith(prefix)).length;
|
||||||
|
|
||||||
const projectCountBefore = countTmpDirs("fusion-test-project-");
|
const projectCountBefore = countTmpDirs(projectPrefix);
|
||||||
const globalCountBefore = countTmpDirs("fusion-test-global-");
|
const globalCountBefore = countTmpDirs(globalPrefix);
|
||||||
const error = new Error("boom");
|
const error = new Error("boom");
|
||||||
const spy = vi.spyOn(TaskStore.prototype, "updateSettings").mockRejectedValueOnce(error);
|
const spy = vi.spyOn(TaskStore.prototype, "updateSettings").mockRejectedValueOnce(error);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await expect(createTestProject()).rejects.toThrow(error);
|
await expect(
|
||||||
|
createTestProject({
|
||||||
|
rootDirPrefix: projectPrefix,
|
||||||
|
globalDirPrefix: globalPrefix,
|
||||||
|
}),
|
||||||
|
).rejects.toThrow(error);
|
||||||
} finally {
|
} finally {
|
||||||
spy.mockRestore();
|
spy.mockRestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(countTmpDirs("fusion-test-project-")).toBe(projectCountBefore);
|
expect(countTmpDirs(projectPrefix)).toBe(projectCountBefore);
|
||||||
expect(countTmpDirs("fusion-test-global-")).toBe(globalCountBefore);
|
expect(countTmpDirs(globalPrefix)).toBe(globalCountBefore);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("createTestProject({ seedTasks }) pre-seeds tasks during setup", async () => {
|
it("createTestProject({ seedTasks }) pre-seeds tasks during setup", async () => {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ export interface CreateTestProjectOptions {
|
|||||||
seedTasks?: number;
|
seedTasks?: number;
|
||||||
globalSettingsDir?: string;
|
globalSettingsDir?: string;
|
||||||
settings?: Partial<Settings>;
|
settings?: Partial<Settings>;
|
||||||
|
rootDirPrefix?: string;
|
||||||
|
globalDirPrefix?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TestProjectFixture {
|
export interface TestProjectFixture {
|
||||||
@@ -67,10 +69,12 @@ function splitSettings(settings?: Partial<Settings>): {
|
|||||||
export async function createTestProject(
|
export async function createTestProject(
|
||||||
options: CreateTestProjectOptions = {},
|
options: CreateTestProjectOptions = {},
|
||||||
): Promise<TestProjectFixture> {
|
): Promise<TestProjectFixture> {
|
||||||
const rootDir = mkdtempSync(join(tmpdir(), "fusion-test-project-"));
|
const rootDirPrefix = options.rootDirPrefix ?? "fusion-test-project-";
|
||||||
|
const globalDirPrefix = options.globalDirPrefix ?? "fusion-test-global-";
|
||||||
|
const rootDir = mkdtempSync(join(tmpdir(), rootDirPrefix));
|
||||||
const globalDir = options.globalSettingsDir
|
const globalDir = options.globalSettingsDir
|
||||||
? options.globalSettingsDir
|
? options.globalSettingsDir
|
||||||
: mkdtempSync(join(tmpdir(), "fusion-test-global-"));
|
: mkdtempSync(join(tmpdir(), globalDirPrefix));
|
||||||
const ownsGlobalDir = !options.globalSettingsDir;
|
const ownsGlobalDir = !options.globalSettingsDir;
|
||||||
|
|
||||||
assertAbsolutePath(rootDir, "rootDir");
|
assertAbsolutePath(rootDir, "rootDir");
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ describe("native integrations", () => {
|
|||||||
mocks.updaterHandlers.clear();
|
mocks.updaterHandlers.clear();
|
||||||
mocks.autoUpdater.autoDownload = false;
|
mocks.autoUpdater.autoDownload = false;
|
||||||
mocks.autoUpdater.autoInstallOnAppQuit = false;
|
mocks.autoUpdater.autoInstallOnAppQuit = false;
|
||||||
|
(mocks.Notification.isSupported as ReturnType<typeof vi.fn>).mockReturnValue(true);
|
||||||
|
|
||||||
mocks.dialog.showSaveDialog.mockResolvedValue({
|
mocks.dialog.showSaveDialog.mockResolvedValue({
|
||||||
canceled: false,
|
canceled: false,
|
||||||
@@ -303,8 +304,10 @@ describe("native integrations", () => {
|
|||||||
setupAutoUpdater(mocks.browserWindow as never);
|
setupAutoUpdater(mocks.browserWindow as never);
|
||||||
await vi.dynamicImportSettled();
|
await vi.dynamicImportSettled();
|
||||||
|
|
||||||
expect(mocks.autoUpdater.autoDownload).toBe(true);
|
await vi.waitFor(() => {
|
||||||
expect(mocks.autoUpdater.autoInstallOnAppQuit).toBe(true);
|
expect(mocks.autoUpdater.autoDownload).toBe(true);
|
||||||
|
expect(mocks.autoUpdater.autoInstallOnAppQuit).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("registers updater listeners and checks for updates", async () => {
|
it("registers updater listeners and checks for updates", async () => {
|
||||||
@@ -313,10 +316,12 @@ describe("native integrations", () => {
|
|||||||
setupAutoUpdater(mocks.browserWindow as never);
|
setupAutoUpdater(mocks.browserWindow as never);
|
||||||
await vi.dynamicImportSettled();
|
await vi.dynamicImportSettled();
|
||||||
|
|
||||||
expect(mocks.autoUpdater.on).toHaveBeenCalledWith("update-available", expect.any(Function));
|
await vi.waitFor(() => {
|
||||||
expect(mocks.autoUpdater.on).toHaveBeenCalledWith("update-downloaded", expect.any(Function));
|
expect(mocks.autoUpdater.on).toHaveBeenCalledWith("update-available", expect.any(Function));
|
||||||
expect(mocks.autoUpdater.on).toHaveBeenCalledWith("error", expect.any(Function));
|
expect(mocks.autoUpdater.on).toHaveBeenCalledWith("update-downloaded", expect.any(Function));
|
||||||
expect(mocks.autoUpdater.checkForUpdates).toHaveBeenCalledTimes(1);
|
expect(mocks.autoUpdater.on).toHaveBeenCalledWith("error", expect.any(Function));
|
||||||
|
expect(mocks.autoUpdater.checkForUpdates).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("update-available triggers notification and renderer IPC", async () => {
|
it("update-available triggers notification and renderer IPC", async () => {
|
||||||
|
|||||||
@@ -148,5 +148,5 @@ describe("foreign start-point no-owned-commit interactions (real git)", () => {
|
|||||||
} finally {
|
} finally {
|
||||||
rmSync(dir, { recursive: true, force: true });
|
rmSync(dir, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
});
|
}, 20_000);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -91,5 +91,5 @@ describe("verification-fix already-on-main reliability interactions (real git)",
|
|||||||
} finally {
|
} finally {
|
||||||
rmSync(dir, { recursive: true, force: true });
|
rmSync(dir, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
});
|
}, 20_000);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user