-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix GitHub Integration tests #20363
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
Fix GitHub Integration tests #20363
Conversation
|
|
||
| @test public async testGetUserRepos() { | ||
| const result = await this.provider.getUserRepos(this.user); | ||
| expect(result).to.include({ url: "https://github.com/gitpod-io/gitpod", name: "gitpod" }); |
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.
GitHub seemingly only considers recent contributions, who knew!
| for (const type of ["contributedTo", "original", "forked"]) { | ||
| const nodes = result.data.viewer[type]?.nodes; | ||
| if (nodes) { | ||
| repos = nodes.map((n: any): RepositoryInfo => { |
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.
This was actually a bug where we always rewrote the existing array if there were nodes for a type. Unlucky for us, even if there weren't, empty JS arrays are truthy, so the repos would get overridden anyway.
| const result = await this.parser.handle( | ||
| {}, | ||
| this.user, | ||
| "https://github.com/eclipse-theia/theia/tree/master/LICENSE", |
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.
The file disappeared, so we had to update it.
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.
Thank you @filiptronicek
$ yarn build && yarn mocha 'dist/github/**/*.spec.js' --exclude './node_modules/**' --exit
...
TestFileProvider
GitHub request took 227 ms
✔ testFileContent (228ms)
TestGithubContextRepositoryProvider
✔ testFetchCommitHistory (280ms)
✔ testGetUserRepos (241ms)
29 passing (8s)
Done in 8.80s.
Description
Looks like we haven't run these in a while (at least a year and a half), and they needed some love. This PR provides that love.
How to test
Run the GitHub integrations tests in
serverThe token is in 1Password.
Related issue(s)
Fixes CLC-930
/hold