this question is related to testing with jest we...
# suitescript
s
this question is related to testing with jest we have a client script that takes in weight, address using the https module how would i test this in local dev env using
Copy code
SuiteCloud Unit Testing
b
the unit testing framework is setup so that when a module has N/https in its dependencies, its actually requiring a test stub
you are supposed to mock the stub so that you can make it behave in a certain way, in this case making it return the stub ClientResponse
which you of course can mock further if you wish to spy on when its methods and properties are accessed
s
I'm confused this is my test which internal calls https method how am i stubing it ?
Copy code
import shiprate from "SuiteScripts/massfufil/shiprate.js";
describe("Shipping rules object should return the correct id ", () => {
    it("will return the correct shipping id   ", () => {
        //shipmentrates(weight, address, sku)
      let  address = {
     //...
        }

        const v1 = shiprate.shipmentrates(5, address, "47080_mf");

        expect(v1).toBe("8855");
    });
});
b
do you know how jest works in general?