Skip to content

Commit

Permalink
fix failing test due to warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
thewahome committed Nov 26, 2024
1 parent b1f58e5 commit bdc2f24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class DeleteWorkspaceItemCommand extends Command {
public async execute(workspaceTreeItem: WorkspaceTreeItem): Promise<void> {
const type = workspaceTreeItem.category && isPluginType(workspaceTreeItem.category) ? "plugin" : "client";
const yesAnswer = vscode.l10n.t("Yes");
const response = await vscode.window.showInformationMessage(
const response = await vscode.window.showWarningMessage(
vscode.l10n.t("Do you want to delete this item?"),
yesAnswer,
vscode.l10n.t("No")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ suite('DeleteWorkspaceItemCommand Tests', () => {

test('execute should show success message and refresh workspace on success', async () => {
const deleteItemStub = sinon.stub(command as any, 'deleteItem').resolves([{ message: 'removed successfully' }]);
const showWarningMessageStub = sinon.stub(vscode.window, 'showWarningMessage').resolves({ title: "Yes" });
const showInformationMessageStub = sinon.stub(vscode.window, 'showInformationMessage').resolves();
const executeCommandStub = sinon.stub(vscode.commands, 'executeCommand').resolves();

await command.execute(workspaceTreeItem);

assert.strictEqual(deleteItemStub.calledOnce, true);
assert.strictEqual(showWarningMessageStub.calledOnceWith("Do you want to delete this item?", sinon.match("Yes"), sinon.match("No")), true);
assert.strictEqual(showInformationMessageStub.calledOnceWith('test-item removed successfully.'), true);
assert.strictEqual(executeCommandStub.calledOnceWith('kiota.workspace.refresh'), true);
});
Expand Down

0 comments on commit bdc2f24

Please sign in to comment.