-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
executable file
·68 lines (62 loc) · 1.45 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
'use strong';
const {DiagnosticSeverity} = require('vscode-languageserver-types');
const alexVSCode = require('.');
const {test} = require('tape');
test('alexVSCode()', t => {
t.plan(4);
t.deepEqual(
alexVSCode({
getText: () => 'He is a video game maniac.',
uri: 'file:///Users/shinnn/foo.txt'
}),
[
{
message: '`He` may be insensitive, use `They`, `It` instead',
range: {
start: {
character: 0,
line: 0
},
end: {
character: 2,
line: 0
}
},
severity: DiagnosticSeverity.Warning
},
{
message: '`maniac` may be insensitive, use `fanatic`, `zealot`, `enthusiast` instead',
range: {
end: {
character: 25,
line: 0
},
start: {
character: 19,
line: 0
}
},
severity: DiagnosticSeverity.Warning
}
],
'should return VS Code diagnostics.'
);
t.deepEqual(
alexVSCode({
getText: () => '```\nHe is a video game maniac.\n```\n',
languageId: 'markdown'
}),
[],
'should regard the content as a markdown when the document is a markdown file.'
);
t.throws(
() => alexVSCode([1, 2]),
/TypeError.*1,2 is not a textDocument\. Expected a VS Code's textDocument\./u,
'should throw a type error when the argument is not a textDocument.'
);
t.throws(
() => alexVSCode(),
/TypeError.*undefined is not a textDocument\. Expected a VS Code's textDocument\./u,
'should throw a type error when it takes no arguments.'
);
});