-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,7 @@ class TestGithubContextRepositoryProvider { | |
|
|
||
| @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 commentThe reason will be displayed to describe this comment to others. Learn more. GitHub seemingly only considers recent contributions, who knew! |
||
| expect(result).to.deep.include({ url: "https://github.com/gitpod-integration-test/example", name: "example" }); | ||
| } | ||
| } | ||
| module.exports = new TestGithubContextRepositoryProvider(); // Only to circumvent no usage warning :-/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -215,19 +215,20 @@ export class GithubRepositoryProvider implements RepositoryProvider { | |
| }`, | ||
| ); | ||
|
|
||
| let repos: RepositoryInfo[] = []; | ||
|
|
||
| const repos: RepositoryInfo[] = []; | ||
| 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 commentThe 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 reposInSection: RepositoryInfo[] = nodes.map((n: any) => { | ||
| return { | ||
| name: n.name, | ||
| url: n.url, | ||
| }; | ||
| }); | ||
| repos.push(...reposInSection); | ||
| } | ||
| } | ||
|
|
||
| return repos; | ||
| } | ||
|
|
||
|
|
||
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.