summaryrefslogtreecommitdiff
path: root/test/test_completion.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-02 00:28:00 +0100
committerw0rp <devw0rp@gmail.com>2017-07-02 10:58:18 +0100
commitb731bd77abca29064600c01ad8df7d7d1033fc7a (patch)
tree414aff0b9a7e1b196231a5f8359a4157f24644c6 /test/test_completion.vader
parent5b731f761f3d405e67398c167a1b9aa16b45e97c (diff)
downloadale-b731bd77abca29064600c01ad8df7d7d1033fc7a.zip
Get automatic completion with tsserver to work
Diffstat (limited to 'test/test_completion.vader')
-rw-r--r--test/test_completion.vader90
1 files changed, 90 insertions, 0 deletions
diff --git a/test/test_completion.vader b/test/test_completion.vader
new file mode 100644
index 00000000..ce7a8ef3
--- /dev/null
+++ b/test/test_completion.vader
@@ -0,0 +1,90 @@
+Execute(TypeScript completions responses should be parsed correctly):
+ AssertEqual [],
+ \ ale#completion#ParseTSServerCompletions({
+ \ 'body': [],
+ \})
+ AssertEqual ['foo', 'bar', 'baz'],
+ \ ale#completion#ParseTSServerCompletions({
+ \ 'body': [
+ \ {'name': 'foo'},
+ \ {'name': 'bar'},
+ \ {'name': 'baz'},
+ \ ],
+ \})
+
+Execute(TypeScript completion details responses should be parsed correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'word': 'abc',
+ \ 'menu': '(property) Foo.abc: number',
+ \ 'info': '',
+ \ 'kind': 'f'
+ \ },
+ \ {
+ \ 'word': 'def',
+ \ 'menu': '(property) Foo.def: number',
+ \ 'info': 'foo bar baz',
+ \ 'kind': 'f'
+ \ },
+ \ ],
+ \ ale#completion#ParseTSServerCompletionEntryDetails({
+ \ 'body': [
+ \ {
+ \ 'name': 'abc',
+ \ 'kind': 'parameterName',
+ \ 'displayParts': [
+ \ {'text': '('},
+ \ {'text': 'property'},
+ \ {'text': ')'},
+ \ {'text': ' '},
+ \ {'text': 'Foo'},
+ \ {'text': '.'},
+ \ {'text': 'abc'},
+ \ {'text': ':'},
+ \ {'text': ' '},
+ \ {'text': 'number'},
+ \ ],
+ \ },
+ \ {
+ \ 'name': 'def',
+ \ 'kind': 'parameterName',
+ \ 'displayParts': [
+ \ {'text': '('},
+ \ {'text': 'property'},
+ \ {'text': ')'},
+ \ {'text': ' '},
+ \ {'text': 'Foo'},
+ \ {'text': '.'},
+ \ {'text': 'def'},
+ \ {'text': ':'},
+ \ {'text': ' '},
+ \ {'text': 'number'},
+ \ ],
+ \ 'documentation': [
+ \ {'text': 'foo'},
+ \ {'text': ' '},
+ \ {'text': 'bar'},
+ \ {'text': ' '},
+ \ {'text': 'baz'},
+ \ ],
+ \ },
+ \ ],
+ \})
+
+Given typescript():
+ let abc = y.
+ let foo = ab
+ let foo = (ab)
+
+Execute(Completion should be done after dots in TypeScript):
+ AssertEqual '.', ale#completion#GetPrefix(&filetype, 1, 13)
+
+Execute(Completion should be done after words in TypeScript):
+ AssertEqual 'ab', ale#completion#GetPrefix(&filetype, 2, 13)
+
+Execute(Completion should be done after words in parens in TypeScript):
+ AssertEqual 'ab', ale#completion#GetPrefix(&filetype, 3, 14)
+
+Execute(Completion should not be done after parens in TypeScript):
+ AssertEqual '', ale#completion#GetPrefix(&filetype, 3, 15)