Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
orionmiz committed Aug 9, 2023
1 parent ad82ddb commit 53ecf5d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/plantae/src/axios/createAxiosInterceptors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ describe("axios:afterResponse -", () => {
name: "myPlugin",
hooks: {
afterResponse: async (res) => {
res.body = "first";
res.headers.set("x-first", "foo");
return res;

return new Response("first", {
headers: res.headers,
});
},
},
});
Expand All @@ -161,9 +163,11 @@ describe("axios:afterResponse -", () => {
name: "secondPlugin",
hooks: {
afterResponse: async (res) => {
res.body = "second";
res.headers.set("x-second", "bar");
return res;

return new Response("second", {
headers: res.headers,
});
},
},
});
Expand Down Expand Up @@ -197,7 +201,7 @@ describe("axios:beforeRequest+afterResponse -", () => {
},
afterResponse: async (res) => {
console.log("res: ", res);
if (res.body === "request plugin is activated") {
if ((await res.text()) === "request plugin is activated") {
res.headers.set("x-request-plugin", "succeed");
return res;
}
Expand Down Expand Up @@ -237,7 +241,7 @@ describe("axios:beforeRequest+afterResponse -", () => {
name: "afterResponsePlugin",
hooks: {
afterResponse: async (res) => {
if (res.body === "request plugin is activated") {
if ((await res.text()) === "request plugin is activated") {
res.headers.set("x-request-plugin", "succeed");
return res;
}
Expand Down Expand Up @@ -277,7 +281,7 @@ describe("axios:beforeRequest+afterResponse -", () => {
name: "afterResponsePlugin",
hooks: {
afterResponse: async (res) => {
if (res.body === "request plugin is activated") {
if ((await res.text()) === "request plugin is activated") {
res.headers.set("x-request-plugin", "succeed");
return res;
}
Expand Down Expand Up @@ -317,7 +321,7 @@ describe("axios:beforeRequest+afterResponse -", () => {
name: "afterResponsePlugin",
hooks: {
afterResponse: async (res) => {
if (res.body === "request plugin is activated") {
if ((await res.text()) === "request plugin is activated") {
res.headers.set("x-request-plugin", "succeed");
return res;
}
Expand Down

0 comments on commit 53ecf5d

Please sign in to comment.