Skip to content

Commit

Permalink
refactor(testing): rename useMiddleware to use
Browse files Browse the repository at this point in the history
closes: nestjs#4073
  • Loading branch information
schiemon committed Oct 23, 2023
1 parent 2b85c08 commit 5ad75c0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -147,7 +147,7 @@ describe('Middleware overriding', () => {
imports: [AppModule],
})
.overrideMiddleware(MiddlewareB)
.useMiddleware(MiddlewareBOverride)
.use(MiddlewareBOverride)
.compile();

const app = testingModule.createNestApplication();
Expand Down
4 changes: 1 addition & 3 deletions packages/testing/interfaces/override-middleware.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ import { Type } from '@nestjs/common';
* @publicApi
*/
export interface OverrideMiddleware {
useMiddleware: (
...newMiddleware: (Type<any> | Function)[]
) => TestingModuleBuilder;
use: (...newMiddleware: (Type<any> | Function)[]) => TestingModuleBuilder;
}
2 changes: 1 addition & 1 deletion packages/testing/testing-module.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class TestingModuleBuilder {
middlewareToOverride: Type<any> | Function,
): OverrideMiddleware {
return {
useMiddleware: (...newMiddleware: (Type<any> | Function)[]) => {
use: (...newMiddleware: (Type<any> | Function)[]) => {
this.middlewareOverloadsMap.set(middlewareToOverride, newMiddleware);
return this;
},
Expand Down

0 comments on commit 5ad75c0

Please sign in to comment.