2
0

perf(e2e): ️ Migrate to Playwright

This commit is contained in:
Baptiste Arnaud
2022-01-28 09:42:31 +01:00
parent c5aaa323d1
commit 73f277fce7
145 changed files with 3104 additions and 2346 deletions

View File

@ -1,4 +1,22 @@
import { NextApiResponse } from 'next'
import { NextApiRequest, NextApiResponse } from 'next'
export const methodNotAllowed = (res: NextApiResponse) =>
res.status(405).json({ message: 'Method Not Allowed' })
export const initMiddleware =
(
handler: (
req: NextApiRequest,
res: NextApiResponse,
middleware: (result: any) => void
) => void
) =>
(req: any, res: any) =>
new Promise((resolve, reject) => {
handler(req, res, (result) => {
if (result instanceof Error) {
return reject(result)
}
return resolve(result)
})
})