1
1
import {
2
- withOAuth ,
3
- withLogging ,
4
- applyMiddleware ,
5
- createMiddleware ,
2
+ withOAuth ,
3
+ withLogging ,
4
+ applyMiddlewares ,
5
+ createMiddleware ,
6
6
} from "./middleware.js" ;
7
7
import { OAuthClientProvider } from "./auth.js" ;
8
8
import { FetchLike } from "../shared/transport.js" ;
@@ -677,7 +677,7 @@ describe("applyMiddleware", () => {
677
677
const response = new Response ( "success" , { status : 200 } ) ;
678
678
mockFetch . mockResolvedValue ( response ) ;
679
679
680
- const composedFetch = applyMiddleware ( ) ( mockFetch ) ;
680
+ const composedFetch = applyMiddlewares ( ) ( mockFetch ) ;
681
681
682
682
expect ( composedFetch ) . toBe ( mockFetch ) ;
683
683
} ) ;
@@ -694,7 +694,7 @@ describe("applyMiddleware", () => {
694
694
return next ( input , { ...init , headers } ) ;
695
695
} ;
696
696
697
- const composedFetch = applyMiddleware ( middleware1 ) ( mockFetch ) ;
697
+ const composedFetch = applyMiddlewares ( middleware1 ) ( mockFetch ) ;
698
698
699
699
await composedFetch ( "https://api.example.com/data" ) ;
700
700
@@ -736,7 +736,7 @@ describe("applyMiddleware", () => {
736
736
return next ( input , { ...init , headers } ) ;
737
737
} ;
738
738
739
- const composedFetch = applyMiddleware (
739
+ const composedFetch = applyMiddlewares (
740
740
middleware1 ,
741
741
middleware2 ,
742
742
middleware3 ,
@@ -765,7 +765,7 @@ describe("applyMiddleware", () => {
765
765
766
766
// Use custom logger to avoid console output
767
767
const mockLogger = jest . fn ( ) ;
768
- const composedFetch = applyMiddleware (
768
+ const composedFetch = applyMiddlewares (
769
769
oauthMiddleware ,
770
770
withLogging ( { logger : mockLogger , statusLevel : 0 } ) ,
771
771
) ( mockFetch ) ;
@@ -803,7 +803,7 @@ describe("applyMiddleware", () => {
803
803
const originalError = new Error ( "Network failure" ) ;
804
804
mockFetch . mockRejectedValue ( originalError ) ;
805
805
806
- const composedFetch = applyMiddleware ( errorMiddleware ) ( mockFetch ) ;
806
+ const composedFetch = applyMiddlewares ( errorMiddleware ) ( mockFetch ) ;
807
807
808
808
await expect ( composedFetch ( "https://api.example.com/data" ) ) . rejects . toThrow (
809
809
"Middleware error: Network failure" ,
@@ -853,7 +853,7 @@ describe("Integration Tests", () => {
853
853
854
854
// Use custom logger to avoid console output
855
855
const mockLogger = jest . fn ( ) ;
856
- const enhancedFetch = applyMiddleware (
856
+ const enhancedFetch = applyMiddlewares (
857
857
withOAuth (
858
858
mockProvider as OAuthClientProvider ,
859
859
"https://mcp-server.example.com" ,
@@ -903,7 +903,7 @@ describe("Integration Tests", () => {
903
903
904
904
// Use custom logger to avoid console output
905
905
const mockLogger = jest . fn ( ) ;
906
- const enhancedFetch = applyMiddleware (
906
+ const enhancedFetch = applyMiddlewares (
907
907
withOAuth (
908
908
mockProvider as OAuthClientProvider ,
909
909
"https://streamable-server.example.com" ,
@@ -971,7 +971,7 @@ describe("Integration Tests", () => {
971
971
972
972
// Use custom logger to avoid console output
973
973
const mockLogger = jest . fn ( ) ;
974
- const enhancedFetch = applyMiddleware (
974
+ const enhancedFetch = applyMiddlewares (
975
975
withOAuth (
976
976
mockProvider as OAuthClientProvider ,
977
977
"https://mcp-server.example.com" ,
@@ -1177,7 +1177,7 @@ describe("createMiddleware", () => {
1177
1177
} ) ;
1178
1178
1179
1179
// Compose with existing middleware
1180
- const enhancedFetch = applyMiddleware (
1180
+ const enhancedFetch = applyMiddlewares (
1181
1181
customAuth ,
1182
1182
customLogging ,
1183
1183
withLogging ( { statusLevel : 400 } ) ,
0 commit comments