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:
parent
61d3cb3f52
commit
5c44dd0373
|
@ -133,6 +133,12 @@ export class Porcelain {
|
||||||
}
|
}
|
||||||
return repo[0];
|
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> {
|
class GithubEntity<T: NodePayload> {
|
||||||
|
@ -200,12 +206,6 @@ export class Repository extends GithubEntity<RepositoryNodePayload> {
|
||||||
.nodes({type: PULL_REQUEST_NODE_TYPE})
|
.nodes({type: PULL_REQUEST_NODE_TYPE})
|
||||||
.map((n) => new PullRequest(this.graph, n.address));
|
.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<
|
class Post<
|
||||||
|
|
|
@ -150,7 +150,7 @@ describe("GitHub porcelain", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Authors", () => {
|
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
|
// So we don't need to manually update the test if a new person posts
|
||||||
expect(authors.length).toMatchSnapshot();
|
expect(authors.length).toMatchSnapshot();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue