-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more tests for completion / hover #175
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Nevill <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great to see some progress on the testing side!
The approach in this PR looks generally sane to me, though it'd be nice to have more test cases.
There is also some non-trivial logic, that chooses what kind of completions should be provided. Those should at some point be tested as well, but that doesn't need to happen in the same PR.
) | ||
|
||
// This is a mock object which serves as a test helper | ||
type MockMetadataService struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this might be used in other tests as well, it should probably live in a separate file.
t.Errorf("Error occurred when calling completeMetricName: %s.\n", err) | ||
} | ||
|
||
if len(*items) != 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we would also check the content of the returned items.
return "testhost:9090" | ||
} | ||
|
||
func TestMetricNameCompletion(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func TestMetricNameCompletion(t *testing.T) { | |
func TestMetricNameCompletion(t *testing.T) { | |
// nolint: funlen |
This is still WIP. It intends to fix #133 at the end.
To create this draft PR because I want to get some early feedback from @slrtbtfs .