Skip to content

Commit 8624ea4

Browse files
committed
(GH-269) Add acceptance test for Workspace Symbols
Previously the Workspace Symbols request was not tested as part of the acceptance suite. This commit adds a Workspace symbols request test and refactors the mock editor client to make it easier to be consumed during development.
1 parent 7712adb commit 8624ea4

File tree

5 files changed

+699
-673
lines changed

5 files changed

+699
-673
lines changed

spec/languageserver/acceptance/end_to_end_spec.rb

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# Format range | X | - | - |
2626
# OnType Formatting | X | - | - |
2727
# Document Symbols | X | - | - |
28-
# Workspace Symbols | - | | |
28+
# Workspace Symbols | - | | X |
2929

3030
describe 'End to End Testing' do
3131
before(:each) do
@@ -321,10 +321,23 @@ def path_to_uri(path)
321321
@client.send_data(@client.puppetfile_getdependencies_request(@client.next_seq_id, puppetfile_uri))
322322
expect(@client).to receive_message_with_request_id_within_timeout([@client.current_seq_id, 10])
323323
result = @client.data_from_request_seq_id(@client.current_seq_id)
324-
# Expect something to be returned
325-
expect(result['result']).not_to be_nil
326-
expect(result['result']['dependencies']).not_to be_nil
327-
expect(result['result']['dependencies']).not_to be_empty
324+
# Expect something to be returned
325+
expect(result['result']).not_to be_nil
326+
expect(result['result']['dependencies']).not_to be_nil
327+
expect(result['result']['dependencies']).not_to be_empty
328+
329+
# Workspace Symbols
330+
@client.send_data(@client.workspace_symbols_request(@client.next_seq_id, ''))
331+
expect(@client).to receive_message_with_request_id_within_timeout([@client.current_seq_id, 15])
332+
result = @client.data_from_request_seq_id(@client.current_seq_id)
333+
# Expect something to be returned
334+
expect(result['result']).not_to be_nil
335+
# Should contain the default puppet user class
336+
index = result['result'].find { |item| item['name'] == 'user' && item['kind'] == 6 }
337+
expect(index).not_to be_nil
338+
# Should contain a profile from the control-repo
339+
index = result['result'].find { |item| item['name'] == 'profile::editorservices' && item['kind'] == 5 }
340+
expect(index).not_to be_nil
328341

329342
# Start shutdown process
330343
@client.clear_messages!

0 commit comments

Comments
 (0)