feat(FN-4122): simplify fan-out badge label, inherit count color from paren
Simplified the fan-out badge label to match the design spec and removed the now-redundant CSS overrides in TaskCard.css, inheriting the count color from the task column instead. Also stabilized verification tests and added a changeset for the patch release. Fusion-Task-Id: FN-4122 Fusion-Task-Lineage: 7dba6f5b-5143-49e9-8edb-2f54a1e2b608
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { mkdtempSync, existsSync } from "node:fs";
|
||||
import { mkdtempSync, existsSync, readdirSync } from "node:fs";
|
||||
import { rm, readFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { isAbsolute, join } from "node:path";
|
||||
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { TaskStore } from "../store.js";
|
||||
import {
|
||||
@@ -127,6 +127,25 @@ describe("test-project fixture", () => {
|
||||
expect(fetched.description).toContain("Validate real TaskStore operations");
|
||||
});
|
||||
|
||||
it("cleans up auto-created temp dirs when setup fails before returning a fixture", async () => {
|
||||
const countTmpDirs = (prefix: string) =>
|
||||
readdirSync(tmpdir()).filter((entry) => entry.startsWith(prefix)).length;
|
||||
|
||||
const projectCountBefore = countTmpDirs("fusion-test-project-");
|
||||
const globalCountBefore = countTmpDirs("fusion-test-global-");
|
||||
const error = new Error("boom");
|
||||
const spy = vi.spyOn(TaskStore.prototype, "updateSettings").mockRejectedValueOnce(error);
|
||||
|
||||
try {
|
||||
await expect(createTestProject()).rejects.toThrow(error);
|
||||
} finally {
|
||||
spy.mockRestore();
|
||||
}
|
||||
|
||||
expect(countTmpDirs("fusion-test-project-")).toBe(projectCountBefore);
|
||||
expect(countTmpDirs("fusion-test-global-")).toBe(globalCountBefore);
|
||||
});
|
||||
|
||||
it("createTestProject({ seedTasks }) pre-seeds tasks during setup", async () => {
|
||||
const fixture = await createFixture({ seedTasks: 4 });
|
||||
|
||||
|
||||
@@ -71,37 +71,52 @@ export async function createTestProject(
|
||||
const globalDir = options.globalSettingsDir
|
||||
? options.globalSettingsDir
|
||||
: mkdtempSync(join(tmpdir(), "fusion-test-global-"));
|
||||
const ownsGlobalDir = !options.globalSettingsDir;
|
||||
|
||||
assertAbsolutePath(rootDir, "rootDir");
|
||||
assertAbsolutePath(globalDir, "globalSettingsDir");
|
||||
|
||||
await mkdir(globalDir, { recursive: true });
|
||||
let store: TaskStore | undefined;
|
||||
|
||||
const store = new TaskStore(rootDir, globalDir);
|
||||
await store.init();
|
||||
try {
|
||||
await mkdir(globalDir, { recursive: true });
|
||||
|
||||
const { globalPatch, projectPatch } = splitSettings(options.settings);
|
||||
await store.updateSettings(projectPatch);
|
||||
store = new TaskStore(rootDir, globalDir);
|
||||
await store.init();
|
||||
|
||||
if (Object.keys(globalPatch).length > 0) {
|
||||
await store.updateGlobalSettings(globalPatch);
|
||||
}
|
||||
const { globalPatch, projectPatch } = splitSettings(options.settings);
|
||||
await store.updateSettings(projectPatch);
|
||||
|
||||
const requestedSeedCount = Math.max(0, Math.floor(options.seedTasks ?? 0));
|
||||
if (requestedSeedCount > 0) {
|
||||
await seedTasks(store, requestedSeedCount);
|
||||
}
|
||||
if (Object.keys(globalPatch).length > 0) {
|
||||
await store.updateGlobalSettings(globalPatch);
|
||||
}
|
||||
|
||||
const cleanup = async () => {
|
||||
store.close();
|
||||
const requestedSeedCount = Math.max(0, Math.floor(options.seedTasks ?? 0));
|
||||
if (requestedSeedCount > 0) {
|
||||
await seedTasks(store, requestedSeedCount);
|
||||
}
|
||||
|
||||
const initializedStore = store;
|
||||
const cleanup = async () => {
|
||||
initializedStore.close();
|
||||
await destroyTestProject(rootDir);
|
||||
|
||||
if (ownsGlobalDir) {
|
||||
await destroyTestProject(globalDir);
|
||||
}
|
||||
};
|
||||
|
||||
return { rootDir, store: initializedStore, globalDir, cleanup };
|
||||
} catch (error) {
|
||||
store?.close();
|
||||
await destroyTestProject(rootDir);
|
||||
|
||||
if (!options.globalSettingsDir) {
|
||||
if (ownsGlobalDir) {
|
||||
await destroyTestProject(globalDir);
|
||||
}
|
||||
};
|
||||
|
||||
return { rootDir, store, globalDir, cleanup };
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user