GH Porcelain: Move `authors` top-level Porcelain (#254)

Currently, the `authors` method is attached at the Repository level.
This is incorrect; it actually finds all the authors in the graph, not
all the authors of that repository. This commit moves the method to the
correct class.

Test plan: This function is only used in test code. The tests still
pass.
This commit is contained in:
Dandelion Mané 2018-05-10 11:24:24 -07:00 committed by GitHub
parent 61d3cb3f52
commit 5c44dd0373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -133,6 +133,12 @@ export class Porcelain {
}
return repo[0];
}
authors(): Author[] {
return this.graph
.nodes({type: AUTHOR_NODE_TYPE})
.map((n) => new Author(this.graph, n.address));
}
}
class GithubEntity<T: NodePayload> {
@ -200,12 +206,6 @@ export class Repository extends GithubEntity<RepositoryNodePayload> {
.nodes({type: PULL_REQUEST_NODE_TYPE})
.map((n) => new PullRequest(this.graph, n.address));
}
authors(): Author[] {
return this.graph
.nodes({type: AUTHOR_NODE_TYPE})
.map((n) => new Author(this.graph, n.address));
}
}
class Post<

View File

@ -150,7 +150,7 @@ describe("GitHub porcelain", () => {
});
it("Authors", () => {
const authors = repo.authors();
const authors = porcelain.authors();
// So we don't need to manually update the test if a new person posts
expect(authors.length).toMatchSnapshot();