Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/biothings/call-apis.js into…
Browse files Browse the repository at this point in the history
… dev
  • Loading branch information
tokebe committed Sep 8, 2024
2 parents 2a3dde9 + 273b866 commit 56bbe94
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
20 changes: 16 additions & 4 deletions __test__/unittest/query_builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ describe("test query builder class", () => {
// @ts-expect-error TODO: change after APIEdge split from query_graph_handler
const builder = new qb(edge);
const res = builder.needPagination(response);
expect(res).toBeFalsy();
expect(res).toMatchObject({
paginationStart: 0,
paginationSize: 0
});
});

test("biothings tagged api with post method should return false", () => {
Expand All @@ -316,7 +319,10 @@ describe("test query builder class", () => {
// @ts-expect-error TODO: change after APIEdge split from query_graph_handler
const builder = new qb(edge);
const res = builder.needPagination(response);
expect(res).toBeFalsy();
expect(res).toMatchObject({
paginationStart: 0,
paginationSize: 0
});
});

test("biothings tagged api with get method and needs pagniation should return true", () => {
Expand All @@ -333,7 +339,10 @@ describe("test query builder class", () => {
// @ts-expect-error TODO: change after APIEdge split from query_graph_handler
const builder = new qb(edge);
const res = builder.needPagination(response);
expect(res).toBeTruthy();
expect(res).not.toMatchObject({
paginationStart: 0,
paginationSize: 0
});
});

test("biothings tagged api with get method and doesn't need pagniation should return false", () => {
Expand All @@ -350,7 +359,10 @@ describe("test query builder class", () => {
// @ts-expect-error TODO: change after APIEdge split from query_graph_handler
const builder = new qb(edge);
const res = builder.needPagination(response);
expect(res).toBeFalsy();
expect(res).toMatchObject({
paginationStart: 0,
paginationSize: 0
});
});
});
});
20 changes: 16 additions & 4 deletions __test__/unittest/template_query_builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ describe("test query builder class", () => {
// @ts-expect-error TODO: change after extracting APIEdge from query_graph_handler
const builder = new qb(edge, queryHandlerOptions);
const res = builder.needPagination(response);
expect(res).toBeFalsy();
expect(res).toMatchObject({
paginationStart: 0,
paginationSize: 0
});
});

test("biothings tagged api with post method should return false", () => {
Expand All @@ -385,7 +388,10 @@ describe("test query builder class", () => {
// @ts-expect-error TODO: change after extracting APIEdge from query_graph_handler
const builder = new qb(edge, queryHandlerOptions);
const res = builder.needPagination(response);
expect(res).toBeFalsy();
expect(res).toMatchObject({
paginationStart: 0,
paginationSize: 0
});
});

test("biothings tagged api with get method and needs pagniation should return true", () => {
Expand All @@ -403,7 +409,10 @@ describe("test query builder class", () => {
// @ts-expect-error TODO: change after extracting APIEdge from query_graph_handler
const builder = new qb(edge, queryHandlerOptions);
const res = builder.needPagination(response);
expect(res).toBeTruthy();
expect(res).not.toMatchObject({
paginationStart: 0,
paginationSize: 0
});
});

test("biothings tagged api with get method and doesn't need pagniation should return false", () => {
Expand All @@ -421,7 +430,10 @@ describe("test query builder class", () => {
// @ts-expect-error TODO: change after extracting APIEdge from query_graph_handler
const builder = new qb(edge, queryHandlerOptions);
const res = builder.needPagination(response);
expect(res).toBeFalsy();
expect(res).toMatchObject({
paginationStart: 0,
paginationSize: 0
});
});
});
});
1 change: 1 addition & 0 deletions src/builder/template_query_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export default class TemplateQueryBuilder extends BaseQueryBuilder {
}
} else if (
this.APIEdge.query_operation.method === "get" &&
this.APIEdge.association != null && // abstract comparison for null and undefined
this.APIEdge.association.api_name === "Monarch API"
) {
if (
Expand Down

0 comments on commit 56bbe94

Please sign in to comment.