Skip to content

Commit

Permalink
Merge pull request #266 from tcet-opensource/eslint-hotfix
Browse files Browse the repository at this point in the history
eslint fixes
  • Loading branch information
TejasNair9977 authored Aug 27, 2023
2 parents e4adcec + c876e2e commit 6963dd3
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions test/routes/infrastructure.test.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import { jest } from '@jest/globals';
import request from 'supertest';
import app from '#app'; // Update this import based on your app's structure
import connector from '#models/databaseUtil'; // Update this import
import infrastructureModel from '#models/infrastructure'; // Update this import
import { jest } from "@jest/globals"; // eslint-disable-line import/no-extraneous-dependencies
import request from "supertest";
import app from "#app"; // Update this import based on your app"s structure
import connector from "#models/databaseUtil"; // Update this import
import infrastructureModel from "#models/infrastructure"; // Update this import

jest.mock('#util');
jest.mock("#util");

let server;
let agent;

beforeAll((done) => {
server = app.listen(5000, () => {
agent = request.agent(server);
connector.set('debug', false);
connector.set("debug", false);
done();
});
});

function cleanUp(callback) {
infrastructureModel
.remove({
name: 'Building A',
type: 'Office',
wing: 'East',
name: "Building A",
type: "Office",
wing: "East",
floor: 3,
capacity: 100,
})
.then(() => {
connector.disconnect((DBerr) => {
if (DBerr) console.log('Database disconnect error: ', DBerr);
if (DBerr) console.log("Database disconnect error: ", DBerr);
server.close((serverErr) => {
if (serverErr) console.log(serverErr);
callback();
Expand All @@ -41,12 +41,12 @@ afterAll((done) => {
cleanUp(done);
});

describe('Infrastructure API', () => {
it('should create infrastructure', async () => {
const response = await agent.post('/infrastructure/add').send({
name: 'Building A',
type: 'Office',
wing: 'East',
describe("Infrastructure API", () => {
it("should create infrastructure", async () => {
const response = await agent.post("/infrastructure/add").send({
name: "Building A",
type: "Office",
wing: "East",
floor: 3,
capacity: 100,
});
Expand All @@ -55,38 +55,38 @@ describe('Infrastructure API', () => {
expect(response.body.res).toMatch(/added user/);
});

describe('after adding infrastructure', () => {
describe("after adding infrastructure", () => {
beforeEach(async () => {
await agent.post('/infrastructure/add').send({
name: 'Building A',
type: 'Office',
wing: 'East',
await agent.post("/infrastructure/add").send({
name: "Building A",
type: "Office",
wing: "East",
floor: 3,
capacity: 100,
});
});

afterEach(async () => {
await infrastructureModel.remove({
name: 'Building A',
type: 'Office',
wing: 'East',
name: "Building A",
type: "Office",
wing: "East",
floor: 3,
capacity: 100,
});
});

it('should read infrastructure', async () => {
it("should read infrastructure", async () => {
const response = await agent
.post('/infrastructure/list')
.send({ name: 'Building A' });
.post("/infrastructure/list")
.send({ name: "Building A" });
expect(response.body.res).not.toBeNull();
});

it('should update infrastructure', async () => {
it("should update infrastructure", async () => {
const response = await agent
.post('/infrastructure/update')
.send({ name: 'Building A' }, { capacity: 150 });
.post("/infrastructure/update")
.send({ name: "Building A" }, { capacity: 150 });

expect(response.status).toBe(200);
expect(response.body.res).toMatch(/updated infrastructure/);
Expand Down

0 comments on commit 6963dd3

Please sign in to comment.