-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as assert from "assert"; | ||
import * as sinon from "sinon"; | ||
import * as vscode from "vscode"; | ||
import { ClipboardManager } from "../manager"; | ||
import { ShowClipboardHistory } from "../commads/showClipboardHistory"; | ||
import { activateExtension, getExtension } from "./common"; | ||
|
||
suite("Show Clipboard History Tests", function () { | ||
let sandbox: sinon.SinonSandbox; | ||
let clipboardManager: ClipboardManager | undefined; | ||
let showClipboardHistory: ShowClipboardHistory; | ||
|
||
suiteSetup(async function () { | ||
if (!(await activateExtension())) { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
setup(function () { | ||
sandbox = sinon.createSandbox(); | ||
clipboardManager = getExtension()?.exports.manager; | ||
if(clipboardManager) { | ||
Check failure on line 22 in src/test/showClipboardHistory.test.ts GitHub Actions / lint
|
||
showClipboardHistory = new ShowClipboardHistory(clipboardManager); | ||
Check failure on line 23 in src/test/showClipboardHistory.test.ts GitHub Actions / ubuntu (VSCode 1.65.0)
Check failure on line 23 in src/test/showClipboardHistory.test.ts GitHub Actions / ubuntu (VSCode stable)
Check failure on line 23 in src/test/showClipboardHistory.test.ts GitHub Actions / ubuntu (VSCode insiders)
Check failure on line 23 in src/test/showClipboardHistory.test.ts GitHub Actions / macos (VSCode 1.65.0)
|
||
} | ||
}); | ||
|
||
teardown(function () { | ||
sandbox.restore(); | ||
showClipboardHistory.dispose(); | ||
Check failure on line 29 in src/test/showClipboardHistory.test.ts GitHub Actions / ubuntu (VSCode 1.65.0)
Check failure on line 29 in src/test/showClipboardHistory.test.ts GitHub Actions / ubuntu (VSCode stable)
Check failure on line 29 in src/test/showClipboardHistory.test.ts GitHub Actions / ubuntu (VSCode insiders)
Check failure on line 29 in src/test/showClipboardHistory.test.ts GitHub Actions / macos (VSCode 1.65.0)
|
||
}); | ||
|
||
test("Show Clipboard History Command Execution", async function () { | ||
const showTextDocumentStub = sandbox.stub(vscode.window, "showTextDocument"); | ||
Check failure on line 33 in src/test/showClipboardHistory.test.ts GitHub Actions / lint
|
||
const openTextDocumentStub = sandbox.stub(vscode.workspace, "openTextDocument"); | ||
Check failure on line 34 in src/test/showClipboardHistory.test.ts GitHub Actions / lint
|
||
|
||
await vscode.commands.executeCommand("clipboard-manager.history.show-buffer"); | ||
Check failure on line 36 in src/test/showClipboardHistory.test.ts GitHub Actions / lint
|
||
|
||
assert.ok(openTextDocumentStub.calledOnce, "openTextDocument should be called once"); | ||
Check failure on line 38 in src/test/showClipboardHistory.test.ts GitHub Actions / lint
|
||
assert.ok(showTextDocumentStub.calledOnce, "showTextDocument should be called once"); | ||
Check failure on line 39 in src/test/showClipboardHistory.test.ts GitHub Actions / lint
|
||
}); | ||
}); | ||
Check failure on line 41 in src/test/showClipboardHistory.test.ts GitHub Actions / lint
|