Skip to content

Add test for resolveQueryByLanguage#938

Merged
shati-patel merged 2 commits intogithub:mainfrom
shati-patel:qc-tests2
Sep 2, 2021
Merged

Add test for resolveQueryByLanguage#938
shati-patel merged 2 commits intogithub:mainfrom
shati-patel:qc-tests2

Conversation

@shati-patel
Copy link
Copy Markdown
Contributor

@shati-patel shati-patel commented Sep 1, 2021

Adding another test! (follow-up to #937).

  • Added a new query simple-javascript-query.ql with an import statement
  • Added test to check that the language resolves to 'javascript'

Checklist

N/A - not user-facing

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • @github/docs-content-codeql has been cc'd in all issues for UI or other user-facing changes made by this pull request.

Copy link
Copy Markdown
Contributor

@adityasharad adityasharad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

}
});

it('should resolve query by language', async function() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes it is useful to test negative results. If you wish, you can add a second test query that looks like the original (no import statement), and a corresponding test function that checks queryInfo.byLanguage is an empty object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I've been trying to test a non-language query, but it keeps resolving the language as javascript anyway 🤔 Maybe because the CLI picks up on a nearby qlpack.yml file? I'll try putting a test query in some different locations!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I haven't found a nice way to do this, so I'm going to skip this for now...)

@shati-patel shati-patel marked this pull request as ready for review September 2, 2021 15:34
@shati-patel shati-patel requested a review from a team as a code owner September 2, 2021 15:34
@shati-patel shati-patel enabled auto-merge (rebase) September 2, 2021 15:38
@shati-patel shati-patel merged commit cdd6738 into github:main Sep 2, 2021
@shati-patel shati-patel deleted the qc-tests2 branch September 2, 2021 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants