Use Git Commit type in GitHub mergedAs edge (#407)

Test plan:
`yarn travis` passes
This commit is contained in:
Dandelion Mané 2018-06-22 12:12:08 -07:00 committed by GitHub
parent 448fb3e1a8
commit 24a7547e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View File

@ -83,8 +83,9 @@ Object {
"5",
],
"dstParts": Array [
"sourcecred",
"git",
"commit",
"COMMIT",
"123",
],
"srcParts": Array [

View File

@ -3,11 +3,11 @@
import {
type Edge,
type EdgeAddressT,
type NodeAddressT,
EdgeAddress,
NodeAddress,
} from "../../core/graph";
import * as GithubNode from "./nodes";
import * as GitNode from "../git/nodes";
export opaque type RawAddress: EdgeAddressT = EdgeAddressT;
@ -65,11 +65,11 @@ export const createEdge = Object.freeze({
}),
mergedAs: (
pull: GithubNode.PullAddress,
commitAddress: NodeAddressT /* TODO: Make this a Git commit node address. */
commit: GitNode.CommitAddress
): Edge => ({
address: toRaw({type: MERGED_AS_TYPE, pull}),
src: GithubNode.toRaw(pull),
dst: commitAddress,
dst: GitNode.toRaw(commit),
}),
hasParent: (
child: GithubNode.ChildAddress,

View File

@ -1,9 +1,10 @@
// @flow
import {type EdgeAddressT, NodeAddress, edgeToParts} from "../../core/graph";
import {type EdgeAddressT, edgeToParts} from "../../core/graph";
import {createEdge, fromRaw, toRaw} from "./edges";
import * as GE from "./edges";
import * as GN from "./nodes";
import {COMMIT_TYPE} from "../git/nodes";
describe("plugins/github/edges", () => {
const nodeExamples = {
@ -45,8 +46,8 @@ describe("plugins/github/edges", () => {
authors: () =>
createEdge.authors(nodeExamples.user(), nodeExamples.issue()),
mergedAs: () => {
const commitAddress = NodeAddress.fromParts(["git", "commit", "123"]);
return createEdge.mergedAs(nodeExamples.pull(), commitAddress);
const commit = {type: COMMIT_TYPE, hash: "123"};
return createEdge.mergedAs(nodeExamples.pull(), commit);
},
hasParent: () =>
createEdge.hasParent(nodeExamples.reviewComment(), nodeExamples.review()),