|
1 |
| -import * as assert from 'assert'; |
2 |
| -import * as vscode from 'vscode'; |
| 1 | +import * as assert from "assert"; |
| 2 | +import * as vscode from "vscode"; |
3 | 3 |
|
4 |
| -import { createFile, clearDirectory, getLastMessage } from './common'; |
| 4 | +import { createFile, clearDirectory, getLastMessage } from "./common"; |
5 | 5 |
|
6 |
| -suite('Extension Test Suite', () => { |
| 6 | +suite("Extension Test Suite", () => { |
7 | 7 | const { workspaceFolders } = vscode.workspace;
|
8 |
| - const directoryPath = workspaceFolders ? workspaceFolders[0].uri.fsPath : ''; |
| 8 | + const directoryPath = workspaceFolders ? workspaceFolders[0].uri.fsPath : ""; |
9 | 9 |
|
10 | 10 | suiteTeardown(() => clearDirectory(directoryPath));
|
11 | 11 |
|
12 | 12 | test('should commit with "chore" type', async () => {
|
13 |
| - const sampleSubject = 'add new file'; |
14 |
| - const expectedMessage = `chore: ${sampleSubject}`; |
| 13 | + const sampleSubject = "add new file"; |
| 14 | + const expectedMessage = `build: ${sampleSubject}`; |
15 | 15 |
|
16 |
| - await createFile(directoryPath, 'Hello World'); |
| 16 | + await createFile(directoryPath, "Hello World"); |
17 | 17 | await vscode.env.clipboard.writeText(sampleSubject);
|
18 |
| - await vscode.commands.executeCommand('gitSemanticCommit.semanticCommit'); |
19 |
| - await vscode.commands.executeCommand('editor.action.clipboardPasteAction'); |
20 |
| - await vscode.commands.executeCommand('workbench.action.quickOpenSelectNext'); |
21 |
| - await vscode.commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem'); |
| 18 | + await vscode.commands.executeCommand("gitSemanticCommit.semanticCommit"); |
| 19 | + await vscode.commands.executeCommand("editor.action.clipboardPasteAction"); |
| 20 | + await vscode.commands.executeCommand( |
| 21 | + "workbench.action.quickOpenSelectNext" |
| 22 | + ); |
| 23 | + await vscode.commands.executeCommand( |
| 24 | + "workbench.action.acceptSelectedQuickOpenItem" |
| 25 | + ); |
22 | 26 | await new Promise(resolve => setTimeout(resolve, 3000));
|
23 | 27 | const { stdout: message } = await getLastMessage(directoryPath);
|
24 | 28 |
|
25 | 29 | assert.equal(message.includes(expectedMessage), true);
|
26 | 30 | });
|
27 | 31 |
|
28 | 32 | test('should commit with a scope and "chore" type', async () => {
|
29 |
| - const sampleScope = 'scope'; |
30 |
| - const sampleSubject = 'add new file'; |
31 |
| - const expectedMessage = `chore(${sampleScope}): ${sampleSubject}`; |
| 33 | + const sampleScope = "scope"; |
| 34 | + const sampleSubject = "add new file"; |
| 35 | + const expectedMessage = `build(${sampleScope}): ${sampleSubject}`; |
32 | 36 |
|
33 |
| - await createFile(directoryPath, 'Hello World'); |
| 37 | + await createFile(directoryPath, "Hello World"); |
34 | 38 | await vscode.env.clipboard.writeText(sampleScope);
|
35 |
| - await vscode.commands.executeCommand('gitSemanticCommit.semanticCommit'); |
36 |
| - await vscode.commands.executeCommand('editor.action.clipboardPasteAction'); |
37 |
| - await vscode.commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem'); |
| 39 | + await vscode.commands.executeCommand("gitSemanticCommit.semanticCommit"); |
| 40 | + await vscode.commands.executeCommand("editor.action.clipboardPasteAction"); |
| 41 | + await vscode.commands.executeCommand( |
| 42 | + "workbench.action.acceptSelectedQuickOpenItem" |
| 43 | + ); |
38 | 44 | await vscode.env.clipboard.writeText(sampleSubject);
|
39 |
| - await vscode.commands.executeCommand('editor.action.clipboardPasteAction'); |
40 |
| - await vscode.commands.executeCommand('workbench.action.quickOpenSelectNext'); |
41 |
| - await vscode.commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem'); |
| 45 | + await vscode.commands.executeCommand("editor.action.clipboardPasteAction"); |
| 46 | + await vscode.commands.executeCommand( |
| 47 | + "workbench.action.quickOpenSelectNext" |
| 48 | + ); |
| 49 | + await vscode.commands.executeCommand( |
| 50 | + "workbench.action.acceptSelectedQuickOpenItem" |
| 51 | + ); |
42 | 52 | await new Promise(resolve => setTimeout(resolve, 3000));
|
43 | 53 | const { stdout: message } = await getLastMessage(directoryPath);
|
44 | 54 |
|
|
0 commit comments