mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 11:02:28 +08:00
30 lines
888 B
TypeScript
30 lines
888 B
TypeScript
![]() |
import { lint } from "./eslint.js";
|
||
|
import { trimIndentation } from "../../../../spec/support/utils.js";
|
||
|
import { describe, expect, it } from "vitest";
|
||
|
|
||
|
describe("Linter", () => {
|
||
|
it("reports some basic errors", async () => {
|
||
|
const result = await lint(trimIndentation`
|
||
|
for (const i = 0; i<10; i++) {
|
||
|
}
|
||
|
`);
|
||
|
expect(result).toMatchObject([
|
||
|
{ message: "'i' is constant.", },
|
||
|
{ message: "Empty block statement." }
|
||
|
]);
|
||
|
});
|
||
|
|
||
|
it("reports no error for correct script", async () => {
|
||
|
const result = await lint(trimIndentation`
|
||
|
const foo = "bar";
|
||
|
console.log(foo.toString());
|
||
|
for (const x of [ 1, 2, 3]) {
|
||
|
console.log(x?.toString());
|
||
|
}
|
||
|
|
||
|
api.showMessage("Hi");
|
||
|
`);
|
||
|
expect(result.length).toBe(0);
|
||
|
});
|
||
|
});
|