Skip to content

Commit

Permalink
update testing with expect
Browse files Browse the repository at this point in the history
  • Loading branch information
priyamsahoo committed Jun 28, 2023
1 parent b3701ad commit 67887e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
15 changes: 11 additions & 4 deletions test/helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from "vscode";
import * as path from "path";
import sinon from "sinon";
import { assert } from "chai";
import { assert, expect } from "chai";
import { LightSpeedCommands } from "../src/definitions/constants";
import { integer } from "vscode-languageclient";
import axios from "axios";
Expand Down Expand Up @@ -222,10 +222,17 @@ export async function testHover(
if (actualHover.length && expectedHover.length) {
expectedHover.forEach((expectedItem, i) => {
const actualItem = actualHover[i];
assert.include(
(actualItem.contents[i] as vscode.MarkdownString).value,
expectedItem.contents[i].toString()
// assert.include(
// (actualItem.contents[i] as vscode.MarkdownString).value,
// expectedItem.contents[i].toString()
// );
console.log(
"actual content -> ",
(actualItem.contents[i] as vscode.MarkdownString).value.toString()
);
expect(
(actualItem.contents[i] as vscode.MarkdownString).value.toString()
).to.include(expectedItem.contents[i].toString());
});
}
}
Expand Down
10 changes: 4 additions & 6 deletions test/testScripts/hover/testWithEE.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ export function testHoverEE(): void {
it("should hover over builtin module option", async () => {
await testHover(docUri1, new vscode.Position(6, 9), [
{
contents: [
"customized message that is printed. If omitted, prints a generic message.",
],
contents: ["customized message"],
},
]);
});
Expand All @@ -74,23 +72,23 @@ export function testHoverEE(): void {
it("should hover over collection module name present in EE (ansible.posix.patch)", async () => {
await testHover(docUri1, new vscode.Position(9, 7), [
{
contents: ["using the GNU patch tool."],
contents: ["GNU patch"],
},
]);
});

it("should hover over collection module option present in EE (ansible.posix.patch -> src)", async () => {
await testHover(docUri1, new vscode.Position(10, 9), [
{
contents: ["accepted by the GNU patch tool."],
contents: ["GNU patch"],
},
]);
});

it("should hover over collection module option present in EE (ansible.posix.patch -> dest)", async () => {
await testHover(docUri1, new vscode.Position(11, 9), [
{
contents: ["remote machine to be patched."],
contents: ["remote machine"],
},
]);
});
Expand Down
4 changes: 1 addition & 3 deletions test/testScripts/hover/testWithoutEE.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ export function testHoverWithoutEE(): void {
it("should hover over builtin module option", async () => {
await testHover(docUri1, new vscode.Position(6, 9), [
{
contents: [
"customized message that is printed. If omitted, prints a generic message.",
],
contents: ["customized message"],
},
]);
});
Expand Down

0 comments on commit 67887e3

Please sign in to comment.