Skip to content

Commit 3717b99

Browse files
committedJan 6, 2022
test: use named import from supertest in tests
1 parent ece892d commit 3717b99

File tree

8 files changed

+9
-8
lines changed

8 files changed

+9
-8
lines changed
 

‎test/external/imports/ts-cjs/test/server-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// /test/server-test.ts
22
// Tests the server's rate limiting middleware
33

4-
import request from 'supertest'
4+
import { agent as request } from 'supertest'
55

66
import app from '../source/app.js'
77

‎test/external/imports/ts-esm/test/server-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// /test/server-test.ts
22
// Tests the server's rate limiting middleware
33

4-
import request from 'supertest'
4+
import { agent as request } from 'supertest'
55

66
import app from '../source/app.js'
77

‎test/external/stores/test/stores-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// /test/stores-test.ts
22
// Tests the rate limiter with various different stores
33

4-
import request from 'supertest'
4+
import { agent as request } from 'supertest'
55

66
import redisStore from '../source/redis-store.js'
77
import mongoStore from '../source/mongo-store.js'

‎test/external/stores/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../../../tsconfig.json",
2+
"extends": "../../../tsconfig.json",
33
"include": ["source/"],
44
"exclude": ["node_modules/"],
55
"compilerOptions": {

‎test/library/headers-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// /test/headers-test.ts
22
// Tests whether the headers sent back by the middleware
33

4-
import request from 'supertest'
4+
import { agent as request } from 'supertest'
55

66
import rateLimit from '../../source/index.js'
77

‎test/library/helpers/create-server.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// /test/helpers/create-server.ts
22
// Create an Express server for testing
33

4-
import createExpressApplication, {
4+
import createApp, {
55
Application,
66
Request,
77
Response,
@@ -19,7 +19,7 @@ export const createServer = (
1919
middleware: RequestHandler | RequestHandler[],
2020
): Application => {
2121
// Create an Express server
22-
const app = createExpressApplication()
22+
const app = createApp()
2323

2424
// Use the middleware
2525
app.use(middleware)

‎test/library/middleware-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { jest } from '@jest/globals'
77
import { Request, Response, NextFunction } from 'express'
8-
import request from 'supertest'
8+
import { agent as request } from 'supertest'
99

1010
import rateLimit, {
1111
LegacyStore,

‎tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"noUnusedLocals": true,
88
"noImplicitReturns": true,
99
"noFallthroughCasesInSwitch": true,
10+
"esModuleInterop": true,
1011
"moduleResolution": "node"
1112
}
1213
}

0 commit comments

Comments
 (0)
Please sign in to comment.