test(f6): E2E for any-file + untitled diff-view (#19)
Migrate test surface to URI-string keys; add out-of-workspace file (persisted in global storage) + untitled-buffer (in-memory, not persisted) cases; assert F6 toggle works with no folder open. No LLM. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -28,8 +28,6 @@ suite("no-workspace activation (#8)", () => {
|
||||
"cowriting.acceptProposal",
|
||||
"cowriting.rejectProposal",
|
||||
"cowriting.proposeAgentEdit",
|
||||
"cowriting.toggleDiffView",
|
||||
"cowriting.pinDiffBaseline",
|
||||
]) {
|
||||
assert.ok(all.includes(command), `${command} is registered`);
|
||||
}
|
||||
@@ -39,4 +37,26 @@ suite("no-workspace activation (#8)", () => {
|
||||
await vscode.commands.executeCommand("cowriting.editSelection");
|
||||
await vscode.commands.executeCommand("cowriting.createThread");
|
||||
});
|
||||
|
||||
// F6 (#19) is workspace-INDEPENDENT: its commands are real (not stubs) even
|
||||
// with no folder open, and the toggle works on an untitled buffer.
|
||||
test("F6 toggle works with no folder open (untitled buffer)", async () => {
|
||||
const all = await vscode.commands.getCommands(true);
|
||||
assert.ok(all.includes("cowriting.toggleDiffView"), "toggleDiffView registered");
|
||||
assert.ok(all.includes("cowriting.pinDiffBaseline"), "pinDiffBaseline registered");
|
||||
const untitled = await vscode.workspace.openTextDocument({ content: "no-folder scratch\n", language: "markdown" });
|
||||
await vscode.window.showTextDocument(untitled);
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
await vscode.commands.executeCommand("cowriting.toggleDiffView");
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
const opened = vscode.window.tabGroups.all.some((g) =>
|
||||
g.tabs.some(
|
||||
(t) =>
|
||||
t.input instanceof vscode.TabInputTextDiff &&
|
||||
t.input.original.scheme === "cowriting-baseline" &&
|
||||
t.input.modified.toString() === untitled.uri.toString(),
|
||||
),
|
||||
);
|
||||
assert.ok(opened, "a cowriting-baseline diff opened for the untitled buffer with no folder");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user