Skip to content

Commit b390c11

Browse files
committed
test: 💍 improved tests
1 parent afdba25 commit b390c11

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/core/__tests__/features/client/client.interceptor.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ describe("Client [ Interceptor ]", () => {
127127
const firstCallback = interceptorCallback({ callback: spy1 });
128128
const secondCallback = interceptorCallback({ callback: spy2 });
129129
client.onError(firstCallback).onError(secondCallback);
130+
createRequestInterceptor(request, { status: 400 });
130131

131132
await request.send();
132133
client.removeOnErrorInterceptors([secondCallback]);
133-
134134
await request.send();
135135

136136
expect(spy1).toBeCalledTimes(2);
@@ -154,6 +154,7 @@ describe("Client [ Interceptor ]", () => {
154154
const firstCallback = interceptorCallback({ callback: spy1 });
155155
const secondCallback = interceptorCallback({ callback: spy2 });
156156
client.onResponse(firstCallback).onResponse(secondCallback);
157+
createRequestInterceptor(request);
157158

158159
await request.send();
159160
client.removeOnResponseInterceptors([secondCallback]);

packages/core/__tests__/features/client/client.middleware.spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resetInterceptors, startServer, stopServer } from "../../server";
1+
import { createRequestInterceptor, resetInterceptors, startServer, stopServer } from "../../server";
22
import { middlewareCallback } from "../../utils";
33
import { testCallbacksExecution } from "../../shared";
44
import { Client } from "client";
@@ -86,6 +86,7 @@ describe("Client [ Middleware ]", () => {
8686
const firstCallback = middlewareCallback({ callback: spy1 });
8787
const secondCallback = middlewareCallback({ callback: spy2 });
8888
client.onRequest(firstCallback).onRequest(secondCallback);
89+
createRequestInterceptor(request);
8990

9091
await request.send();
9192
client.removeOnRequestInterceptors([secondCallback]);
@@ -100,6 +101,7 @@ describe("Client [ Middleware ]", () => {
100101
const firstCallback = middlewareCallback({ callback: spy1 });
101102
const secondCallback = middlewareCallback({ callback: spy2 });
102103
client.onAuth(firstCallback).onAuth(secondCallback);
104+
createRequestInterceptor(authRequest);
103105

104106
await authRequest.send();
105107
client.removeOnAuthInterceptors([secondCallback]);

0 commit comments

Comments
 (0)