From 25014bf8ebf4f26b3d8057a70fd6e8ec861107ff Mon Sep 17 00:00:00 2001 From: Fanis Tharropoulos Date: Wed, 17 Jul 2024 10:42:23 +0300 Subject: [PATCH] test(delete-query): test that it passes query params to api call --- test/Typesense/Document.spec.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/Typesense/Document.spec.js b/test/Typesense/Document.spec.js index f09223a0..5e070724 100644 --- a/test/Typesense/Document.spec.js +++ b/test/Typesense/Document.spec.js @@ -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); + }); });