Tidy and add tests for resolveLanguages commands#937
Merged
shati-patel merged 3 commits intogithub:mainfrom Sep 1, 2021
Merged
Tidy and add tests for resolveLanguages commands#937shati-patel merged 3 commits intogithub:mainfrom
resolveLanguages commands#937shati-patel merged 3 commits intogithub:mainfrom
Conversation
adityasharad
approved these changes
Aug 31, 2021
Contributor
adityasharad
left a comment
There was a problem hiding this comment.
Nice! One minor suggestion that I thought of from reading the existing code and the Chai docs. There are of course many equivalent ways of writing the same test, so pick whatever you think is clear and readable.
Comment on lines
+60
to
+64
| expect(languages['cpp']).not.to.be.undefined; | ||
| expect(languages['csharp']).not.to.be.undefined; | ||
| expect(languages['java']).not.to.be.undefined; | ||
| expect(languages['javascript']).not.to.be.undefined; | ||
| expect(languages['python']).not.to.be.undefined; |
Contributor
There was a problem hiding this comment.
Reading the Chai docs, I think there's an equivalent way of writing what we had before, with the added advantage of giving a more helpful message if the key is missing. Does this work?
for (const expectedLanguage of ['cpp', 'csharp', 'go', 'java', 'javascript', 'python']) {
expect(languages).to.have.property(expectedLanguage).that.is.not.undefined;
}I also added Go since we can expect that to exist, might as well test all supported languages.
Contributor
Author
There was a problem hiding this comment.
Thank you, that looks nicer! (and also works 😄)
I'll merge this and start looking at more interesting tests in a follow-up PR.
1b1ea33 to
46abd02
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First stage of tidying up and adding tests. See #915 (review) and the linked (internal) issue.
findLanguageout of "run-remote-query" and into a more general place ("helpers"), since it's used in a few functions and this seemed like a more logical placeresolveLanguages(basically copied from theresolveQlpackstest above 😅)I haven't yet added a test for the other functions from #915, since they require a bit more setup. Stay tuned for a follow-up PR 😎
Checklist
N/A: no user-facing changes
@github/docs-content-codeqlhas been cc'd in all issues for UI or other user-facing changes made by this pull request.