fetchGithubRepo: remove vestigial data field (#142)

The example-repo.json file is regenerated with large diffs due to the
change in indentation level throughout the file.

Test plan:
Sanity check the snapshot (close inspection is unnecessary due to the
simplicity of the code change). Check that CI pases.
This commit is contained in:
Dandelion Mané 2018-04-24 15:46:16 -07:00 committed by GitHub
parent 6a3e4d754c
commit 8fdfacd097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 301 additions and 306 deletions

View File

@ -14,7 +14,7 @@ require("../testUtil").configureEnzyme();
describe("githubPluginAdapter", () => { describe("githubPluginAdapter", () => {
it("operates on the example repo", () => { it("operates on the example repo", () => {
const parser = new GithubParser("sourcecred/example-repo"); const parser = new GithubParser("sourcecred/example-repo");
parser.addData(exampleRepoData.data); parser.addData(exampleRepoData);
const graph = parser.graph; const graph = parser.graph;
const result = graph const result = graph

View File

@ -1,5 +1,4 @@
{ {
"data": {
"repository": { "repository": {
"id": "MDEwOlJlcG9zaXRvcnkxMjMyNTUwMDY=", "id": "MDEwOlJlcG9zaXRvcnkxMjMyNTUwMDY=",
"issues": { "issues": {
@ -309,5 +308,4 @@
} }
} }
} }
}
} }

View File

@ -53,10 +53,7 @@ export default function fetchGithubRepo(
payload payload
).then((x) => { ).then((x) => {
ensureNoMorePages(x); ensureNoMorePages(x);
// TODO: We wrap back up in the "data" object to maintain return x;
// compatibility. At some point, let's strip this out and modify
// clients of `example-data.json`.
return {data: x};
}); });
} }

View File

@ -8,7 +8,7 @@ import exampleRepoData from "./demoData/example-repo.json";
describe("GithubParser", () => { describe("GithubParser", () => {
describe("whole repo parsing", () => { describe("whole repo parsing", () => {
const parser = new GithubParser("sourcecred/example-repo"); const parser = new GithubParser("sourcecred/example-repo");
parser.addData(exampleRepoData.data); parser.addData(exampleRepoData);
const graph = parser.graph; const graph = parser.graph;
it("parses the entire example-repo as expected", () => { it("parses the entire example-repo as expected", () => {
@ -68,7 +68,7 @@ describe("GithubParser", () => {
describe("issue parsing", () => { describe("issue parsing", () => {
it("parses a simple issue (https://github.com/sourcecred/example-repo/issues/1)", () => { it("parses a simple issue (https://github.com/sourcecred/example-repo/issues/1)", () => {
const issue1 = exampleRepoData.data.repository.issues.nodes[0]; const issue1 = exampleRepoData.repository.issues.nodes[0];
expect(issue1.number).toBe(1); expect(issue1.number).toBe(1);
const parser = new GithubParser("sourcecred/example-repo"); const parser = new GithubParser("sourcecred/example-repo");
parser.addIssue(issue1); parser.addIssue(issue1);
@ -76,7 +76,7 @@ describe("GithubParser", () => {
}); });
it("parses an issue with comments (https://github.com/sourcecred/example-repo/issues/6)", () => { it("parses an issue with comments (https://github.com/sourcecred/example-repo/issues/6)", () => {
const issue6 = exampleRepoData.data.repository.issues.nodes[3]; const issue6 = exampleRepoData.repository.issues.nodes[3];
expect(issue6.number).toBe(6); expect(issue6.number).toBe(6);
const parser = new GithubParser("sourcecred/example-repo"); const parser = new GithubParser("sourcecred/example-repo");
parser.addIssue(issue6); parser.addIssue(issue6);
@ -86,14 +86,14 @@ describe("GithubParser", () => {
describe("pull request parsing", () => { describe("pull request parsing", () => {
it("parses a simple pull request (https://github.com/sourcecred/example-repo/pull/3)", () => { it("parses a simple pull request (https://github.com/sourcecred/example-repo/pull/3)", () => {
const pr3 = exampleRepoData.data.repository.pullRequests.nodes[0]; const pr3 = exampleRepoData.repository.pullRequests.nodes[0];
expect(pr3.number).toBe(3); expect(pr3.number).toBe(3);
const parser = new GithubParser("sourcecred/example-repo"); const parser = new GithubParser("sourcecred/example-repo");
parser.addPullRequest(pr3); parser.addPullRequest(pr3);
expect(parser.graph).toMatchSnapshot(); expect(parser.graph).toMatchSnapshot();
}); });
it("parses a pr with review comments (https://github.com/sourcecred/example-repo/pull/3)", () => { it("parses a pr with review comments (https://github.com/sourcecred/example-repo/pull/3)", () => {
const pr5 = exampleRepoData.data.repository.pullRequests.nodes[1]; const pr5 = exampleRepoData.repository.pullRequests.nodes[1];
expect(pr5.number).toBe(5); expect(pr5.number).toBe(5);
const parser = new GithubParser("sourcecred/example-repo"); const parser = new GithubParser("sourcecred/example-repo");
parser.addPullRequest(pr5); parser.addPullRequest(pr5);