Use Git Commit type in GitHub mergedAs edge (#407)
Test plan: `yarn travis` passes
This commit is contained in:
parent
448fb3e1a8
commit
24a7547e16
|
@ -83,8 +83,9 @@ Object {
|
||||||
"5",
|
"5",
|
||||||
],
|
],
|
||||||
"dstParts": Array [
|
"dstParts": Array [
|
||||||
|
"sourcecred",
|
||||||
"git",
|
"git",
|
||||||
"commit",
|
"COMMIT",
|
||||||
"123",
|
"123",
|
||||||
],
|
],
|
||||||
"srcParts": Array [
|
"srcParts": Array [
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
import {
|
import {
|
||||||
type Edge,
|
type Edge,
|
||||||
type EdgeAddressT,
|
type EdgeAddressT,
|
||||||
type NodeAddressT,
|
|
||||||
EdgeAddress,
|
EdgeAddress,
|
||||||
NodeAddress,
|
NodeAddress,
|
||||||
} from "../../core/graph";
|
} from "../../core/graph";
|
||||||
import * as GithubNode from "./nodes";
|
import * as GithubNode from "./nodes";
|
||||||
|
import * as GitNode from "../git/nodes";
|
||||||
|
|
||||||
export opaque type RawAddress: EdgeAddressT = EdgeAddressT;
|
export opaque type RawAddress: EdgeAddressT = EdgeAddressT;
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ export const createEdge = Object.freeze({
|
||||||
}),
|
}),
|
||||||
mergedAs: (
|
mergedAs: (
|
||||||
pull: GithubNode.PullAddress,
|
pull: GithubNode.PullAddress,
|
||||||
commitAddress: NodeAddressT /* TODO: Make this a Git commit node address. */
|
commit: GitNode.CommitAddress
|
||||||
): Edge => ({
|
): Edge => ({
|
||||||
address: toRaw({type: MERGED_AS_TYPE, pull}),
|
address: toRaw({type: MERGED_AS_TYPE, pull}),
|
||||||
src: GithubNode.toRaw(pull),
|
src: GithubNode.toRaw(pull),
|
||||||
dst: commitAddress,
|
dst: GitNode.toRaw(commit),
|
||||||
}),
|
}),
|
||||||
hasParent: (
|
hasParent: (
|
||||||
child: GithubNode.ChildAddress,
|
child: GithubNode.ChildAddress,
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import {type EdgeAddressT, NodeAddress, edgeToParts} from "../../core/graph";
|
import {type EdgeAddressT, edgeToParts} from "../../core/graph";
|
||||||
import {createEdge, fromRaw, toRaw} from "./edges";
|
import {createEdge, fromRaw, toRaw} from "./edges";
|
||||||
import * as GE from "./edges";
|
import * as GE from "./edges";
|
||||||
import * as GN from "./nodes";
|
import * as GN from "./nodes";
|
||||||
|
import {COMMIT_TYPE} from "../git/nodes";
|
||||||
|
|
||||||
describe("plugins/github/edges", () => {
|
describe("plugins/github/edges", () => {
|
||||||
const nodeExamples = {
|
const nodeExamples = {
|
||||||
|
@ -45,8 +46,8 @@ describe("plugins/github/edges", () => {
|
||||||
authors: () =>
|
authors: () =>
|
||||||
createEdge.authors(nodeExamples.user(), nodeExamples.issue()),
|
createEdge.authors(nodeExamples.user(), nodeExamples.issue()),
|
||||||
mergedAs: () => {
|
mergedAs: () => {
|
||||||
const commitAddress = NodeAddress.fromParts(["git", "commit", "123"]);
|
const commit = {type: COMMIT_TYPE, hash: "123"};
|
||||||
return createEdge.mergedAs(nodeExamples.pull(), commitAddress);
|
return createEdge.mergedAs(nodeExamples.pull(), commit);
|
||||||
},
|
},
|
||||||
hasParent: () =>
|
hasParent: () =>
|
||||||
createEdge.hasParent(nodeExamples.reviewComment(), nodeExamples.review()),
|
createEdge.hasParent(nodeExamples.reviewComment(), nodeExamples.review()),
|
||||||
|
|
Loading…
Reference in New Issue