Skip to content

Commit

Permalink
assert the test server.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
chappelo committed Oct 5, 2024
1 parent 216ae70 commit 32911d5
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/fixtures/custom/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ app.use((req: any, res: any, next: express.NextFunction) => {
req.stringValue = 'fancyStringForContext';
next();
});
RegisterRoutes(app);
(RegisterRoutes as (app: express.Express) => void)(app);

// It's important that this come after the main routes are registered
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/express-dynamic-controllers/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ app.use((req: any, res: any, next: express.NextFunction) => {
req.stringValue = 'fancyStringForContext';
next();
});
RegisterRoutes(app);
(RegisterRoutes as (app: express.Express) => void)(app);

// It's important that this come after the main routes are registered
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/express-openapi3/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ app.use((req: any, res: any, next: express.NextFunction) => {
req.stringValue = 'fancyStringForContext';
next();
});
RegisterRoutes(app);
(RegisterRoutes as (app: express.Express) => void)(app);

// It's important that this come after the main routes are registered
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/express-root-security/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { RegisterRoutes } from './routes';
export const app: express.Express = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
RegisterRoutes(app);
(RegisterRoutes as (app: express.Express) => void)(app);

// It's important that this come after the main routes are registered
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/express-router-with-custom-multer/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ router.use((req: any, res: any, next: express.NextFunction) => {

import multer = require('multer');

RegisterRoutes(router, {
(RegisterRoutes as (router: express.Router, options: { multer: ReturnType<typeof multer> }) => void)(router, {
multer: multer({
limits: {
fieldNameSize: 120,
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/express-router/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ router.use((req: any, res: any, next: express.NextFunction) => {
next();
});

RegisterRoutes(router);
(RegisterRoutes as (router: express.Router) => void)(router);

// It's important that this come after the main routes are registered
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/express/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ app.use((req: any, res: any, next: express.NextFunction) => {
req.stringValue = 'fancyStringForContext';
next();
});
RegisterRoutes(app);
(RegisterRoutes as (app: express.Express) => void)(app);

// It's important that this come after the main routes are registered
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/hapi/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Server } from '@hapi/hapi';
import { Server, ServerApplicationState } from '@hapi/hapi';
import '../controllers/rootController';

import '../controllers/optionsController';
Expand All @@ -23,7 +23,7 @@ import { RegisterRoutes } from './routes';

export const server = new Server({});

RegisterRoutes(server);
(RegisterRoutes as (app: Server<ServerApplicationState>) => void)(server);

server.start().catch(err => {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/inversify-async/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ app.use(bodyParser.json());
app.use((req, res, next) => {
methodOverride()(req, res, next);
});
RegisterRoutes(app);
(RegisterRoutes as (app: express.Router) => void)(app);

// It's important that this come after the main routes are registered
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/inversify-cpg/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ app.use(bodyParser.json());
app.use((req, res, next) => {
methodOverride()(req, res, next);
});
RegisterRoutes(app);
(RegisterRoutes as (app: express.Express) => void)(app);

// It's important that this come after the main routes are registered
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/inversify-dynamic-container/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ app.use(bodyParser.json());
app.use((req, res, next) => {
methodOverride()(req, res, next);
});
RegisterRoutes(app);
(RegisterRoutes as (app: express.Express) => void)(app);

// It's important that this come after the main routes are registered
app.use((err: any, _req: express.Request, res: express.Response, _next: express.NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/inversify/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ app.use(bodyParser.json());
app.use((req, res, next) => {
methodOverride()(req, res, next);
});
RegisterRoutes(app);
(RegisterRoutes as (app: express.Router) => void)(app);

// It's important that this come after the main routes are registered
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/koa-multer-options/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ app.use(bodyParser());

const router = new KoaRouter();

RegisterRoutes(router);
(RegisterRoutes as (router: KoaRouter) => void)(router);

// It's important that this come after the main routes are registered
app.use(async (context, next) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/koa/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ app.use(bodyParser());

const router = new KoaRouter();

RegisterRoutes(router);
(RegisterRoutes as (router: KoaRouter) => void)(router);

// It's important that this come after the main routes are registered
app.use(async (context, next) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/koaNoAdditional/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ app.use(bodyParser());

const router = new KoaRouter();

RegisterRoutes(router);
(RegisterRoutes as (router: KoaRouter) => void)(router);

// It's important that this come after the main routes are registered
app.use(async (context, next) => {
Expand Down

0 comments on commit 32911d5

Please sign in to comment.