Skip to content

Commit

Permalink
fix most tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rjawesome committed Sep 29, 2023
1 parent e729a8a commit 7ab4e74
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion __test__/data/biothings/drug_response_example_edge.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"size": "1000"
},
"_supportBatch": false,
"method": "get",
"_method": "get",
"_pathParams": [],
"_server": "https://biothings.ncats.io/drug_response_kp",
"_path": "/query",
Expand Down
2 changes: 1 addition & 1 deletion __test__/data/biothings/mychem_example_edge.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"_supportBatch": true,
"_inputSeparator": ",",
"method": "post",
"_method": "post",
"_pathParams": [],
"_server": "https://mychem.info/v1",
"_path": "/query",
Expand Down
2 changes: 1 addition & 1 deletion __test__/data/biothings/mygene_example_edge.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"_supportBatch": true,
"_inputSeparator": ",",
"method": "post",
"_method": "post",
"_pathParams": [],
"_server": "https://mygene.info/v3",
"_path": "/query",
Expand Down
4 changes: 2 additions & 2 deletions data/jq/pair/biothings.jq
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ if $edge.query_operation._method == "post" then
if $edge.input | type == "object" then
generateCurieWithInputs($edge.association.input_id; $item.query; $edge.input.queryInputs) as $curie | .[$curie] = .[$curie] + [$item]
else
generateCurie($edge.association.input_id; $item.query) as $curie | .[$curie] = .[$curie] + [$item]
generateCurieWithInputs($edge.association.input_id; $item.query; $edge.input | toArray) as $curie | .[$curie] = .[$curie] + [$item]
end
end
)
else
if ($edge.input | type) == "object" then
.response as $res | generateCurie($edge.association.input_id; $edge.input.queryInputs) as $curie | {} | .[$curie] = [$res]
else
.response as $res | generateCurie($edge.association.input_id; $edge.input) as $curie | {} | .[$curie] = [$res]
.response as $res | generateCurie($edge.association.input_id; ($edge.input | toArray)[0]) as $curie | {} | .[$curie] = [$res]
end
end
2 changes: 1 addition & 1 deletion src/transformers/jq_transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const filterStringsPair = Object.fromEntries(

export default class JQTransformer extends BaseTransformer {
// TODO more specific typing?
async wrap(res: JSONDoc | JSONDoc[]): Promise<JSONDoc | JSONDoc[]> {
async wrap(res: JSONDoc | JSONDoc[]): Promise<JSONDoc> {
if (this.config.wrap)
res = JSON.parse(
(await jq.run(generateFilterString(this.config.wrap, this.edge), res, { input: "json" })) as string,
Expand Down

0 comments on commit 7ab4e74

Please sign in to comment.