diff --git a/test/plugin.test.ts b/test/plugin.test.ts index 99d954d..3831bb3 100644 --- a/test/plugin.test.ts +++ b/test/plugin.test.ts @@ -1,6 +1,6 @@ import { existsSync, readdirSync, readFileSync } from "fs"; import { join } from "path"; -import { format, Options } from "prettier"; +import { format, Options, ParserOptions } from "prettier"; import * as jinjaPlugin from "../src/index"; const prettify = (code: string, options: Options) => @@ -42,3 +42,13 @@ tests.forEach((test) => { } }); }); + +test("node has correct locStart and -End", () => { + const plugin = jinjaPlugin.parsers["jinja-template"]; + + const ast = plugin.parse(`

{{ test }}

`, {}, {} as ParserOptions); + const node = Object.values(ast.nodes)[0]!; + + expect(plugin.locStart(node)).toEqual(3); + expect(plugin.locEnd(node)).toEqual(13); +});