test(coding-agent): adapted plugin-install and loader-accent tests to landed behavior changes
- plugin-install-validation mocks now answer the bun pm cache probe that refreshBunGitCache issues before bun update on git re-installs. - working-accent tests render the loader before asserting accent computation counts: colorizers run lazily at render time since the loader layout cache landed.
This commit is contained in:
@@ -15,6 +15,25 @@ function emptyStream(): ReadableStream<Uint8Array> {
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock response for the `bun pm cache` probe the manager runs before a git
|
||||
* re-install (refreshBunGitCache). Points at a nonexistent directory so the
|
||||
* cache refresh is a no-op.
|
||||
*/
|
||||
function pmCacheSubprocess(tmpRoot: string, cmd: string[]): Subprocess {
|
||||
expect(cmd).toEqual(["bun", "pm", "cache"]);
|
||||
const body = new Response(path.join(tmpRoot, "no-such-bun-cache")).body;
|
||||
if (!body) {
|
||||
throw new Error("Failed to create response stream");
|
||||
}
|
||||
return {
|
||||
pid: 3,
|
||||
stdout: body,
|
||||
stderr: emptyStream(),
|
||||
exited: Promise.resolve(0),
|
||||
} as Subprocess;
|
||||
}
|
||||
|
||||
interface PluginFixture {
|
||||
readonly version: string;
|
||||
readonly source: string;
|
||||
@@ -255,6 +274,7 @@ describe("PluginManager.install load validation", () => {
|
||||
exited: prepare.then(() => 0),
|
||||
} as Subprocess;
|
||||
}
|
||||
if (cmd[1] === "pm") return pmCacheSubprocess(tmpRoot, cmd);
|
||||
// The manager follows a git re-install with `bun update <name>` to refresh
|
||||
// the lockfile pin (#3063). The mock treats it as a no-op exit-0 — the
|
||||
// on-disk state already reflects the v2 install above.
|
||||
@@ -390,6 +410,7 @@ describe("PluginManager.install load validation", () => {
|
||||
exited: prepare.then(() => 0),
|
||||
} as Subprocess;
|
||||
}
|
||||
if (cmd[1] === "pm") return pmCacheSubprocess(tmpRoot, cmd);
|
||||
expect(cmd).toEqual(["bun", "update", "git-plugin"]);
|
||||
const prepare = (async () => {
|
||||
// bun update re-resolves the ref and rewrites the lockfile pin
|
||||
@@ -503,6 +524,7 @@ describe("PluginManager.install load validation", () => {
|
||||
exited: prepare.then(() => 0),
|
||||
} as Subprocess;
|
||||
}
|
||||
if (cmd[1] === "pm") return pmCacheSubprocess(tmpRoot, cmd);
|
||||
expect(cmd).toEqual(["bun", "update", "git-plugin"]);
|
||||
const prepare = (async () => {
|
||||
await Bun.write(bunLockPath, '# bun.lock\n"git-plugin": "github:org/plugin#sha-update"\n');
|
||||
|
||||
Reference in New Issue
Block a user