Skip to content

Commit 6e274c8

Browse files
committed
Add unit tests for js-comint--process-completion-output
1 parent 5b50ada commit 6e274c8

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

js-comint-test.el

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,47 @@ reduce((prev, curr) => prev + curr, 0);" "^9$")))
169169
(setq js-comint-program-command original-command-value
170170
js-use-nvm original-use-jvm-value
171171
js-nvm-current-version original-nvm-version))))
172+
173+
(ert-deftest js-comint--process-completion-output/test-globals ()
174+
"Completing an empty string."
175+
(should
176+
(equal
177+
(js-comint--process-completion-output
178+
"
179+
AbortController AbortSignal AggregateError Array
180+
181+
constructor
182+
183+
> "
184+
"")
185+
'("AbortController"
186+
"AbortSignal"
187+
"AggregateError"
188+
"Array"
189+
"constructor"))))
190+
191+
(ert-deftest js-comint--process-completion-output/test-single-completion ()
192+
"Completion of \"Arr\" yields a single result and type info."
193+
(should (equal (js-comint--process-completion-output
194+
"Array
195+
// [Function: Array]"
196+
"Arr")
197+
'("Array"))))
198+
199+
(ert-deftest js-comint--process-completion-output/test-method-completion ()
200+
"Completion of object properties should give list of properties prefixed with name."
201+
(should
202+
(equal
203+
(js-comint--process-completion-output
204+
"Array.
205+
Array.__proto__ Array.hasOwnProperty Array.isPrototypeOf Array.propertyIsEnumerable Array.toLocaleString
206+
Array.valueOf
207+
208+
> Array."
209+
"Array.")
210+
'("Array.__proto__"
211+
"Array.hasOwnProperty"
212+
"Array.isPrototypeOf"
213+
"Array.propertyIsEnumerable"
214+
"Array.toLocaleString"
215+
"Array.valueOf"))))

0 commit comments

Comments
 (0)