Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyang committed Jan 4, 2024
1 parent 9171524 commit 5c5dc85
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/test/showClipboardHistory.test.ts
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

View workflow job for this annotation

GitHub Actions / lint

[eslint] reported by reviewdog 🐶 Insert `·` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Insert `·`","line":22,"column":7,"nodeType":null,"messageId":"insert","endLine":22,"endColumn":7,"fix":{"range":[698,698],"text":" "}}
showClipboardHistory = new ShowClipboardHistory(clipboardManager);

Check failure on line 23 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu (VSCode 1.65.0)

command 'clipboard-manager.history.show-buffer' already exists

Check failure on line 23 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu (VSCode stable)

command 'clipboard-manager.history.show-buffer' already exists

Check failure on line 23 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu (VSCode insiders)

command 'clipboard-manager.history.show-buffer' already exists

Check failure on line 23 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / macos (VSCode 1.65.0)

command 'clipboard-manager.history.show-buffer' already exists

Check failure on line 23 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / windows (VSCode 1.65.0)

command 'clipboard-manager.history.show-buffer' already exists
}
});

teardown(function () {
sandbox.restore();
showClipboardHistory.dispose();

Check failure on line 29 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu (VSCode 1.65.0)

Cannot read property 'dispose' of undefined

Check failure on line 29 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu (VSCode stable)

Cannot read properties of undefined (reading 'dispose')

Check failure on line 29 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu (VSCode insiders)

Cannot read properties of undefined (reading 'dispose')

Check failure on line 29 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / macos (VSCode 1.65.0)

Cannot read property 'dispose' of undefined

Check failure on line 29 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / windows (VSCode 1.65.0)

Cannot read property 'dispose' of undefined
});

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

View workflow job for this annotation

GitHub Actions / lint

[eslint] reported by reviewdog 🐶 Replace `vscode.window,·"showTextDocument"` with `⏎······vscode.window,⏎······"showTextDocument"⏎····` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `vscode.window,·\"showTextDocument\"` with `⏎······vscode.window,⏎······\"showTextDocument\"⏎····`","line":33,"column":47,"nodeType":null,"messageId":"replace","endLine":33,"endColumn":80,"fix":{"range":[1013,1046],"text":"\n vscode.window,\n \"showTextDocument\"\n "}}
const openTextDocumentStub = sandbox.stub(vscode.workspace, "openTextDocument");

Check failure on line 34 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / lint

[eslint] reported by reviewdog 🐶 Replace `vscode.workspace,·"openTextDocument"` with `⏎······vscode.workspace,⏎······"openTextDocument"⏎····` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `vscode.workspace,·\"openTextDocument\"` with `⏎······vscode.workspace,⏎······\"openTextDocument\"⏎····`","line":34,"column":47,"nodeType":null,"messageId":"replace","endLine":34,"endColumn":83,"fix":{"range":[1095,1131],"text":"\n vscode.workspace,\n \"openTextDocument\"\n "}}

await vscode.commands.executeCommand("clipboard-manager.history.show-buffer");

Check failure on line 36 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / lint

[eslint] reported by reviewdog 🐶 Replace `"clipboard-manager.history.show-buffer"` with `⏎······"clipboard-manager.history.show-buffer"⏎····` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `\"clipboard-manager.history.show-buffer\"` with `⏎······\"clipboard-manager.history.show-buffer\"⏎····`","line":36,"column":42,"nodeType":null,"messageId":"replace","endLine":36,"endColumn":81,"fix":{"range":[1176,1215],"text":"\n \"clipboard-manager.history.show-buffer\"\n "}}

assert.ok(openTextDocumentStub.calledOnce, "openTextDocument should be called once");

Check failure on line 38 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / lint

[eslint] reported by reviewdog 🐶 Replace `openTextDocumentStub.calledOnce,·"openTextDocument·should·be·called·once"` with `⏎······openTextDocumentStub.calledOnce,⏎······"openTextDocument·should·be·called·once"⏎····` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `openTextDocumentStub.calledOnce,·\"openTextDocument·should·be·called·once\"` with `⏎······openTextDocumentStub.calledOnce,⏎······\"openTextDocument·should·be·called·once\"⏎····`","line":38,"column":15,"nodeType":null,"messageId":"replace","endLine":38,"endColumn":88,"fix":{"range":[1233,1306],"text":"\n openTextDocumentStub.calledOnce,\n \"openTextDocument should be called once\"\n "}}
assert.ok(showTextDocumentStub.calledOnce, "showTextDocument should be called once");

Check failure on line 39 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / lint

[eslint] reported by reviewdog 🐶 Replace `showTextDocumentStub.calledOnce,·"showTextDocument·should·be·called·once"` with `⏎······showTextDocumentStub.calledOnce,⏎······"showTextDocument·should·be·called·once"⏎····` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `showTextDocumentStub.calledOnce,·\"showTextDocument·should·be·called·once\"` with `⏎······showTextDocumentStub.calledOnce,⏎······\"showTextDocument·should·be·called·once\"⏎····`","line":39,"column":15,"nodeType":null,"messageId":"replace","endLine":39,"endColumn":88,"fix":{"range":[1323,1396],"text":"\n showTextDocumentStub.calledOnce,\n \"showTextDocument should be called once\"\n "}}
});
});

Check failure on line 41 in src/test/showClipboardHistory.test.ts

View workflow job for this annotation

GitHub Actions / lint

[eslint] reported by reviewdog 🐶 Insert `⏎` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Insert `⏎`","line":41,"column":4,"nodeType":null,"messageId":"insert","endLine":41,"endColumn":4,"fix":{"range":[1408,1408],"text":"\n"}}

0 comments on commit 5c5dc85

Please sign in to comment.