Skip to content

Commit e2804b1

Browse files
committed
add failing test
1 parent 10a09db commit e2804b1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/template-linter-test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import * as semver from 'semver';
2+
3+
import TemplateLinter from '../src/template-linter';
4+
import { type Server } from '../src';
5+
import { TextDocument } from 'vscode-languageserver-textdocument';
6+
7+
describe('template-linter', function () {
8+
describe('sourcesForDocument', function () {
9+
const linter = new TemplateLinter({
10+
options: {
11+
type: 'node',
12+
},
13+
} as Server);
14+
15+
it('supports empty template-lint version', function () {
16+
const doc: TextDocument = {
17+
uri: 'test.gjs',
18+
getText() {
19+
return 'let a = 12;<template>1</template>';
20+
},
21+
} as TextDocument;
22+
23+
expect(linter['sourcesForDocument'](doc, null)).toEqual(['let a = 12;<template>1</template>']);
24+
});
25+
it('process gjs for template-lint v4', function () {
26+
const doc: TextDocument = {
27+
uri: 'test.gjs',
28+
getText() {
29+
return 'let a = 12;<template>1</template>';
30+
},
31+
} as TextDocument;
32+
33+
console.log(semver.parse('~4.3.1'));
34+
expect(linter['sourcesForDocument'](doc, semver.parse('~4.3.1'))).toEqual(['<template>1</template>']);
35+
});
36+
});
37+
});

0 commit comments

Comments
 (0)