Skip to content

Commit

Permalink
Fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeharder committed Dec 20, 2024
1 parent d7439da commit 90fab86
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 109 deletions.
17 changes: 0 additions & 17 deletions eng/tools/eslint-plugin-tsv/test/e2e-realfs.test.ts

This file was deleted.

52 changes: 52 additions & 0 deletions eng/tools/eslint-plugin-tsv/test/e2e.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { ESLint } from "eslint";
import { join, resolve } from "path";
import { describe, expect, it } from "vitest";
import eslintPluginTsv from "../src/eslint-plugin-tsv.js";

function createESLint() {
return new ESLint({
cwd: "/",
overrideConfig: eslintPluginTsv.configs.recommended,
overrideConfigFile: true,
});
}

describe("lint-text", () => {
it("Not-Kebab-Case/Not.KebabCase", async () => {
const filePath = "/specification/Not-Kebab-Case/Not.KebabCase/tspconfig.yaml";
const eslint = createESLint();

const results = await eslint.lintText("", { filePath: filePath });

expect(results).toHaveLength(1);
expect(results[0].filePath).toBe(filePath);
expect(results[0].messages[0].ruleId).toBe("tsv/kebab-case-org");
});

it("Not-Kebab-Case-Disabled/Not.KebabCase", async () => {
const filePath = "/specification/Not-Kebab-Case-Disabled/Not.KebabCase/tspconfig.yaml";
const eslint = createESLint();

const results = await eslint.lintText("# eslint-disable tsv/kebab-case-org", {
filePath: filePath,
});

expect(results).toHaveLength(1);
expect(results[0].filePath).toBe(filePath);
expect(results[0].messages).toHaveLength(0);
});
});

describe("lint-files", () => {
const specsFolder = resolve(__filename, "../../../../../specification");

it("contosowidgetmanager/Contso.WidgetManager", async () => {
const eslint = createESLint();
const filePath = join(specsFolder, "contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml");
const results = await eslint.lintFiles(filePath);

expect(results).toHaveLength(1);
expect(results[0].filePath).toBe(filePath);
expect(results[0].messages).toHaveLength(0);
});
});

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions eng/tools/eslint-plugin-tsv/test/utils/e2e.ts

This file was deleted.

0 comments on commit 90fab86

Please sign in to comment.