-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathextension.test.ts
More file actions
39 lines (32 loc) · 1.44 KB
/
extension.test.ts
File metadata and controls
39 lines (32 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import * as assert from 'assert';
import * as vscode from 'vscode';
suite('Extension Test Suite', () => {
vscode.window.showInformationMessage('Start all tests.');
test('Extension should be activated', async () => {
// The extension is expected to be activated when tests run
const extension = vscode.extensions.getExtension('DocDetective.doc-detective');
assert.ok(extension, 'Extension should be available');
// If extension is not already activated, activate it
if (!extension?.isActive) {
await extension?.activate();
}
assert.ok(extension?.isActive, 'Extension should be activated');
});
test('Commands should be registered', async () => {
// Get all available commands
const commands = await vscode.commands.getCommands(true);
// Test for the extension's commands
assert.ok(commands.includes('doc-detective.helloWorld'), 'helloWorld command should be registered');
assert.ok(commands.includes('doc-detective.simpleView'), 'simpleView command should be registered');
});
test('WebView provider should be registered', async () => {
// Try to open the view; if it's not properly registered, this will fail
try {
await vscode.commands.executeCommand('docDetectiveView.focus');
// If we get here without an error, the command is registered
assert.ok(true, 'WebView provider should be registered');
} catch (e) {
assert.fail('WebView provider should be registered, but focus command failed');
}
});
});