meeshkan / unmock-js

Fuzz test your REST API calls
https://unmock.io
93 stars 8 forks source link

transform.responseBody doesn't seem to work in react native #415

Open JamesTrickeyD opened 4 years ago

JamesTrickeyD commented 4 years ago

Description

transform.responseBody doesn't seem to work in react native

Steps to Reproduce

IN REACT NATIVE:

beforeAll(() => {
  const responseHeaders = {
    "content-type": "application/json",
  };
  unmock.on();
  unmock
    .nock(baseUrlForPayment, "AUTHENTICATION_ENDPOINT")
    .post(ENDPOINTS.AUTHENTICATION)
    .reply(
      200,
      {
        test: "hello",
      }
    )

  authenticationEndpoint = unmock.services["AUTHENTICATION_ENDPOINT"];
});

 describe("startAuthenticationSaga", () => {
    describe("when server returns 200", () => {
      it("should respond appropriately to an authentication failure", async () => {
        authenticationEndpoint.state(
          transform.responseBody("test").const("bye"),
        );

       // Run test and returned log body 

    });
})

Expected Result

// Run test and returned log body === "bye"

Actual Result

Additional Context

// Run test and returned log body === "hello"

JamesTrickeyD commented 4 years ago

It this lib still active? (Sorry not being rude - genuine question)