Validate all jobs › PoST New Job › should should post new job
thrown: “Exceeded timeout of 5000 ms for a hook.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See .**
5 | let jwtToken = '' > 6 | beforeAll(async () =>{ await connectDatabase()
| ^
7 |
8 | const res = await request(app).post("/api/v1/register").send(
9 | {
`
> import app from "../app";
> import request from "supertest";
> import { connectDatabase, closeDatabase } from "./dbcontroller";
> let jwtToken = ''
> beforeAll(async () =>{ await connectDatabase()
>
> const res = await request(app).post("/api/v1/register").send(
> {
> name: "saikats",
> email: "[email protected]",
> password: "1310655785w",
> }
> )
> console.log(res.body)
> jwtToken= res.body.token
> });
import express from "express";
import dotenv from "dotenv";
import cookieParser from "cookie-parser";
import fileUpload from "express-fileupload";
import auth from "./routes/auth.js";
import jobs from "./routes/jobs.js";
import bodyParser from "body-parser";
const app = express();
// Setting up config.env file variables
dotenv.config();
// Setup body parser
app.use(bodyParser.json())
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// Set cookie parser
app.use(cookieParser());
// Set up file upload
app.use(fileUpload());
// Importing and using all routes
app.use("/api/v1", auth);
app.use("/api/v1", jobs);
// Handle unhandled routes
app.all("*", (req, res) => {
return res.status(404).json({
error: `Route not found`,
});
});
export default app;
i tried to increse the speed , it didnt help at all
i have already tried many methods didnt able to solve the issue , i tried it without await , then res.body give me undefined .