Archify | New Registry…; creators ordered Model, Registry, Diagram, Decision; 0.8.1
This commit is contained in:
@@ -349,6 +349,30 @@ export async function run(): Promise<void> {
|
||||
await vscode.workspace.fs.delete(bad);
|
||||
});
|
||||
|
||||
await check('Archify | New Registry… creates a registry file and opens the registry view; creators are ordered', async () => {
|
||||
const commands = vscode.extensions.getExtension(EXTENSION_ID)?.packageJSON.contributes as { commands: { command: string }[]; menus: Record<string, { command: string; group: string }[]> };
|
||||
const creators = commands.menus['explorer/context'].filter((m) => /^archify\.new/.test(m.command));
|
||||
assert.deepEqual(creators.map((m) => m.command), ['archify.newModel', 'archify.newRegistry', 'archify.newDiagram', 'archify.newDecision']);
|
||||
assert.deepEqual(creators.map((m) => m.group), ['zzz_archify@1', 'zzz_archify@2', 'zzz_archify@3', 'zzz_archify@4']);
|
||||
const folder = workspaceFile('model/registry');
|
||||
const window = vscode.window as unknown as Record<string, unknown>;
|
||||
const originalInput = window.showInputBox;
|
||||
window.showInputBox = async () => 'partners';
|
||||
try {
|
||||
await vscode.commands.executeCommand('archify.newRegistry', folder);
|
||||
} finally {
|
||||
window.showInputBox = originalInput;
|
||||
}
|
||||
const file = vscode.Uri.joinPath(folder, 'partners.archify-registry');
|
||||
const text = new TextDecoder().decode(await vscode.workspace.fs.readFile(file));
|
||||
assert.match(text, /^elements:/m);
|
||||
const tab = await waitFor('registry view tab', () =>
|
||||
vscode.window.tabGroups.all.flatMap((g) => g.tabs).find((t) => t.isActive && t.input instanceof vscode.TabInputCustom && t.input.viewType === 'archify.registry' && t.input.uri.toString() === file.toString()),
|
||||
);
|
||||
assert.ok(tab);
|
||||
await vscode.workspace.fs.delete(file);
|
||||
});
|
||||
|
||||
await check('Archify | New Diagram… → Model creates main.archify from the folder name', async () => {
|
||||
const folder = workspaceFile('new-shop');
|
||||
await vscode.workspace.fs.createDirectory(folder);
|
||||
|
||||
Reference in New Issue
Block a user