Skip to content

Commit

Permalink
test(delete-query): test that it passes query params to api call
Browse files Browse the repository at this point in the history
  • Loading branch information
tharropoulos committed Jul 17, 2024
1 parent 6a1939b commit 25014bf
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/Typesense/Document.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,32 @@ describe("Document", function () {
expect(returnData).to.eventually.deep.equal(documentResult).notify(done);
});
});
it("passes query params to delete", function (done) {
const queryParams = { ignore_not_found: true };
mockAxios
.onDelete(
apiCall.uriFor(
"/collections/companies/documents/124",
typesense.configuration.nodes[0],
),
null,
{
Accept: "application/json, text/plain, */*",
"Content-Type": "application/json",
"X-TYPESENSE-API-KEY": typesense.configuration.apiKey,
},
)
.reply((config) => {
expect(config.params).to.deep.equal(queryParams);
return [
200,
JSON.stringify(documentResult),
{ "content-type": "application/json" },
];
});

let returnData = document.delete(queryParams);

expect(returnData).to.eventually.deep.equal(documentResult).notify(done);
});
});

0 comments on commit 25014bf

Please sign in to comment.