diff --git a/integration/testing/middleware-override/e2e/middleware-override.spec.ts b/integration/testing/middleware-override/e2e/middleware-override.spec.ts index c700eb31ea0..92229ff8ac8 100644 --- a/integration/testing/middleware-override/e2e/middleware-override.spec.ts +++ b/integration/testing/middleware-override/e2e/middleware-override.spec.ts @@ -98,9 +98,9 @@ describe('Middleware overriding', () => { imports: [AppModule], }) .overrideMiddleware(MiddlewareA) - .useMiddleware(MiddlewareAOverride) + .use(MiddlewareAOverride) .overrideMiddleware(MiddlewareC) - .useMiddleware(MiddlewareC1Override, MiddlewareC2Override) + .use(MiddlewareC1Override, MiddlewareC2Override) .compile(); const app = testingModule.createNestApplication(); @@ -147,7 +147,7 @@ describe('Middleware overriding', () => { imports: [AppModule], }) .overrideMiddleware(MiddlewareB) - .useMiddleware(MiddlewareBOverride) + .use(MiddlewareBOverride) .compile(); const app = testingModule.createNestApplication(); diff --git a/packages/testing/interfaces/override-middleware.interface.ts b/packages/testing/interfaces/override-middleware.interface.ts index 8824edba6b6..2035ff7c2f6 100644 --- a/packages/testing/interfaces/override-middleware.interface.ts +++ b/packages/testing/interfaces/override-middleware.interface.ts @@ -6,7 +6,5 @@ import { Type } from '@nestjs/common'; * @publicApi */ export interface OverrideMiddleware { - useMiddleware: ( - ...newMiddleware: (Type | Function)[] - ) => TestingModuleBuilder; + use: (...newMiddleware: (Type | Function)[]) => TestingModuleBuilder; } diff --git a/packages/testing/testing-module.builder.ts b/packages/testing/testing-module.builder.ts index 9faff479514..f0753fcb4ce 100644 --- a/packages/testing/testing-module.builder.ts +++ b/packages/testing/testing-module.builder.ts @@ -101,7 +101,7 @@ export class TestingModuleBuilder { middlewareToOverride: Type | Function, ): OverrideMiddleware { return { - useMiddleware: (...newMiddleware: (Type | Function)[]) => { + use: (...newMiddleware: (Type | Function)[]) => { this.middlewareOverloadsMap.set(middlewareToOverride, newMiddleware); return this; },