Skip to content

Commit

Permalink
Removes avatarUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbs committed Jul 25, 2024
1 parent de8792d commit d055626
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
24 changes: 8 additions & 16 deletions __test__/projects/GitHubRepositoryDataSource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ test("It loads repositories from data source", async () => {
loginsDataSource: {
async getLogins() {
return [{
name: "acme",
avatarUrl: "https://example.com/avatar.png"
name: "acme"
}]
}
},
Expand All @@ -37,8 +36,7 @@ test("It maps repositories from GraphQL to the GitHubRepository model", async ()
loginsDataSource: {
async getLogins() {
return [{
name: "acme",
avatarUrl: "https://example.com/avatar.png"
name: "acme"
}]
}
},
Expand Down Expand Up @@ -126,8 +124,7 @@ test("It queries for both .yml and .yaml file extension with specifying .yml ext
loginsDataSource: {
async getLogins() {
return [{
name: "acme",
avatarUrl: "https://example.com/avatar.png"
name: "acme"
}]
}
},
Expand Down Expand Up @@ -155,8 +152,7 @@ test("It queries for both .yml and .yaml file extension with specifying .yaml ex
loginsDataSource: {
async getLogins() {
return [{
name: "acme",
avatarUrl: "https://example.com/avatar.png"
name: "acme"
}]
}
},
Expand Down Expand Up @@ -184,8 +180,7 @@ test("It queries for both .yml and .yaml file extension with no extension", asyn
loginsDataSource: {
async getLogins() {
return [{
name: "acme",
avatarUrl: "https://example.com/avatar.png"
name: "acme"
}]
}
},
Expand Down Expand Up @@ -213,14 +208,11 @@ test("It loads repositories for all logins", async () => {
loginsDataSource: {
async getLogins() {
return [{
name: "acme",
avatarUrl: "https://example.com/avatar.png"
name: "acme"
}, {
name: "somecorp",
avatarUrl: "https://example.com/avatar.png"
name: "somecorp"
}, {
name: "techsystems",
avatarUrl: "https://example.com/avatar.png"
name: "techsystems"
}]
}
},
Expand Down
11 changes: 3 additions & 8 deletions src/features/projects/data/GitHubLoginDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ export default class GitHubLoginDataSource implements IGitHubLoginDataSource {
query {
viewer {
login
avatarUrl
organizations(first: 100) {
nodes {
login
avatarUrl
}
}
}
Expand All @@ -39,16 +37,13 @@ export default class GitHubLoginDataSource implements IGitHubLoginDataSource {
}
const viewer = response.viewer
const personalLogin: GitHubLogin = {
name: viewer.login,
avatarUrl: viewer.avatarUrl
name: viewer.login
}
const organizationLogins: GitHubLogin[] = viewer
.organizations
.nodes
.map((e: { login: string, avatarUrl: string }) => {
const name = e.login
const avatarUrl = e.avatarUrl
return { name, avatarUrl }
.map((e: { login: string }) => {
return { name: e.login }
})
return [personalLogin].concat(organizationLogins)
}
Expand Down
1 change: 0 additions & 1 deletion src/features/projects/domain/IGitHubLoginDataSource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export type GitHubLogin = {
readonly name: string
readonly avatarUrl: string
}

export default interface IGitHubLoginDataSource {
Expand Down

0 comments on commit d055626

Please sign in to comment.