Skip to content

Commit

Permalink
updated tests to work with new handler logic
Browse files Browse the repository at this point in the history
  • Loading branch information
marcodarko committed Sep 8, 2021
1 parent 2378ec5 commit b2856d8
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 517 deletions.
15 changes: 0 additions & 15 deletions __test__/integration/BatchEdgeQueryHandler.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
const QNode = require("../../src/query_node");
const QEdge = require("../../src/query_edge");
const QExeEdge = require("../../src/query_execution_edge")
const BatchEdgeQueryHandler = require("../../src/batch_edge_query");
const meta_kg = require("@biothings-explorer/smartapi-kg");

Expand All @@ -9,18 +6,6 @@ describe("Testing BatchEdgeQueryHandler Module", () => {
kg.constructMetaKGSync();

describe("Testing query function", () => {
// test("test with one query edge", async () => {
// let gene_node1 = new QNode("n1", { category: "Gene", id: "NCBIGene:1017" });
// let chemical_node1 = new QNode("n3", { category: "SmallMolecule" });
// const edge1 = new QEdge("e01", { subject: gene_node1, object: chemical_node1 });
// const exeEdge1 = new QExeEdge(edge1, false, undefined);
// const batchHandler = new BatchEdgeQueryHandler(kg);
// batchHandler.setEdges([edge1]);
// expect(chemical_node1.hasEquivalentIDs()).toEqual(false);
// const res = await batchHandler.query([edge1]);
// expect(res.length).toBeGreaterThan(1);
// expect(chemical_node1.hasEquivalentIDs()).toEqual(true);
// })

test("test subscribe and unsubscribe function", () => {
const batchHandler = new BatchEdgeQueryHandler(kg);
Expand Down
19 changes: 1 addition & 18 deletions __test__/integration/QEdge2BTEEdgeHandler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,16 @@ describe("Testing NodeUpdateHandler Module", () => {
}
}
}
//gene_node1.setEquivalentIDs(node1_equivalent_ids);
const node2_equivalent_ids = {
"NCBIGene:1017": {
db_ids: {
NCBIGene: ["1017"],
SYMBOL: ['CDK2']
}
},
"NCBIGene:1018": {
db_ids: {
NCBIGene: ["1018"],
SYMBOL: ['CDK3']
}
}
}

const gene_node2 = new QNode("n2", { categories: "Gene", ids: ["NCBIGene:1017", "NCBIGene:1018"] });
const gene_node1_with_id_annotated = new QNode("n1", { categories: "Gene", ids: "NCBIGene:1017" });
gene_node1_with_id_annotated.setEquivalentIDs(node1_equivalent_ids);
//gene_node2.setEquivalentIDs(node2_equivalent_ids);
const invalid_node = new QNode("n3", { categories: "INVALID", curie: ["NCBIGene:1017", "NCBIGene:1018"] })
const chemical_node1 = new QNode("n3", { categories: "SmallMolecule" });
const chemical_node2 = new QNode("n4", { categories: "SmallMolecule", curie: "CHEMBL.COMPUND:CHEMBL744" });
const edge1 = new QEdge("e01", { subject: gene_node1, object: chemical_node1 });
const edge2 = new QEdge("e02", { subject: gene_node1_with_id_annotated, object: chemical_node1 });
const edge3 = new QEdge('e04', { subject: gene_node2, object: chemical_node1 });
const edge4 = new QEdge('e05', { object: gene_node2, subject: chemical_node1 });
const invalid_edge = new QEdge("e03", { subject: invalid_node, object: chemical_node1 })

describe("Testing _getCuries function", () => {
test("test edge with one curie input return an array of one", () => {
Expand Down
20 changes: 1 addition & 19 deletions __test__/integration/QueryEdge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,16 @@ describe("Testing QueryEdge Module", () => {
}
}
}
//gene_node1.setEquivalentIDs(node1_equivalent_ids);
const node2_equivalent_ids = {
"NCBIGene:1017": {
db_ids: {
NCBIGene: ["1017"],
SYMBOL: ['CDK2']
}
},
"NCBIGene:1018": {
db_ids: {
NCBIGene: ["1018"],
SYMBOL: ['CDK3']
}
}
}

const gene_node2 = new QNode("n2", { categories: "Gene", ids: ["NCBIGene:1017", "NCBIGene:1018"] });
const gene_node1_with_id_annotated = new QNode("n1", { categories: "Gene", ids: "NCBIGene:1017" });
gene_node1_with_id_annotated.setEquivalentIDs(node1_equivalent_ids);
//gene_node2.setEquivalentIDs(node2_equivalent_ids);
const invalid_node = new QNode("n3", { categories: "INVALID", curie: ["NCBIGene:1017", "NCBIGene:1018"] })
const chemical_node1 = new QNode("n3", { categories: "SmallMolecule" });
const chemical_node2 = new QNode("n4", { categories: "SmallMolecule", curie: "CHEMBL.COMPUND:CHEMBL744" });
const edge1 = new QEdge("e01", { subject: gene_node1, object: chemical_node1 });
const edge2 = new QEdge("e02", { subject: gene_node1_with_id_annotated, object: chemical_node1 });
const edge3 = new QEdge('e04', { subject: gene_node2, object: chemical_node1 });
const edge4 = new QEdge('e05', { object: gene_node2, subject: chemical_node1 });
const edge5 = new QEdge('e06', { object: gene_node1_with_id_annotated, subject: chemical_node1 });
const invalid_edge = new QEdge("e03", { subject: invalid_node, object: chemical_node1 })

describe("Testing isReversed function", () => {
test("test if only the object of the edge has curie defined, should return true", () => {
Expand Down
Loading

0 comments on commit b2856d8

Please sign in to comment.