Skip to content

Commit

Permalink
fixed lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
santoshshinde2012 committed Mar 13, 2024
1 parent 951aad1 commit aaf8916
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 43 deletions.
17 changes: 8 additions & 9 deletions coverage/lcov.info
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,14 @@ DA:22,5
DA:23,5
DA:24,5
DA:25,5
DA:26,2
DA:28,5
DA:32,4
LF:10
LH:10
DA:29,4
LF:8
LH:8
BRDA:21,0,0,5
BRDA:25,1,0,2
BRF:2
BRH:2
BRDA:25,1,1,3
BRF:3
BRH:3
end_of_record
TN:
SF:src/components/BaseApi.ts
Expand Down Expand Up @@ -367,12 +366,12 @@ DA:1,5
DA:3,5
DA:5,5
DA:7,5
DA:8,2
DA:8,1
DA:11,5
DA:19,5
LF:7
LH:7
BRDA:7,0,0,2
BRDA:7,0,0,1
BRF:1
BRH:1
end_of_record
Expand Down
7 changes: 2 additions & 5 deletions src/abstractions/ApiError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReasonPhrases, StatusCodes } from "http-status-codes";
import { ReasonPhrases, StatusCodes } from 'http-status-codes';

export interface IError {
status: number;
Expand All @@ -22,10 +22,7 @@ class ApiError extends Error implements IError {
super();
this.message = msg;
this.status = statusCode;
if(statusCode === StatusCodes.NOT_FOUND) {
name = ReasonPhrases.NOT_FOUND;
}
this.name = name;
this.name = statusCode === StatusCodes.NOT_FOUND ? ReasonPhrases.NOT_FOUND : name;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/BaseApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Response, Router, NextFunction } from 'express';
import { Response, Router } from 'express';
import { StatusCodes } from 'http-status-codes';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/database/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { database, user, password, host, dbLogging } = connection;

const sequelizeConnection = new Sequelize(database, user, password, {
host,
logging: false,
logging: dbLogging,
dialect: 'postgres' as Dialect,
});

Expand Down
54 changes: 27 additions & 27 deletions test-report.xml
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<testExecutions version="1">
<file path="/Users/santosh/Documents/workspace/boilerplates/node-ts-sequelize-pg-boilerplate/tests/unit-tests/lib/logger.spec.ts">
<testCase name="Logger Lib should create a new log directory if one doesn&apos;t already exist" duration="5"/>
<testCase name="Logger Lib should create a new log directory if one doesn&apos;t already exist" duration="11"/>
</file>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-ts-sequelize-pg-boilerplate/tests/unit-tests/middleware/error-handler.spec.ts">
<testCase name="ErrorHandler middleware with 0 status code" duration="9"/>
<testCase name="ErrorHandler middleware with 0 status code" duration="4"/>
<testCase name="ErrorHandler middleware with 200 status code" duration="0"/>
<testCase name="ErrorHandler middleware with 200 status code" duration="1"/>
<testCase name="ErrorHandler middleware with 200 status code and updated env variables" duration="0"/>
</file>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-ts-sequelize-pg-boilerplate/tests/unit-tests/components/system-status/SystemStatusController.spec.ts">
<testCase name="System Status Controller test getError method" duration="2"/>
<testCase name="System Status Controller test getSystemInfo method" duration="4"/>
<testCase name="System Status Controller test getError method" duration="3"/>
<testCase name="System Status Controller test getSystemInfo method" duration="3"/>
<testCase name="System Status Controller test getServerTime method" duration="1"/>
<testCase name="System Status Controller test getResourceUsage method" duration="0"/>
<testCase name="System Status Controller test getProcessInfo method" duration="1"/>
</file>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-ts-sequelize-pg-boilerplate/tests/unit-tests/components/enquiry/EnquiryController.spec.ts">
<testCase name="Enquiry Controller should register routes and return router" duration="3"/>
<testCase name="Enquiry Controller should get all enquiries" duration="1"/>
<testCase name="Enquiry Controller should handle errors to get all enquiries" duration="0"/>
<testCase name="Enquiry Controller should get details of a specific enquiry" duration="1"/>
<testCase name="Enquiry Controller should handle errors to get all enquiries" duration="0"/>
<testCase name="Enquiry Controller should create enquiry" duration="1"/>
<testCase name="Enquiry Controller should throw BAD_REQUEST error if name and country are not provided" duration="0"/>
<testCase name="Enquiry Controller should handle errors in create enquiry" duration="0"/>
<testCase name="Enquiry Controller should update enquiry" duration="1"/>
<testCase name="Enquiry Controller should handle errors in update enquiry" duration="0"/>
<testCase name="Enquiry Controller should delete enquiry" duration="0"/>
<testCase name="Enquiry Controller should handle errors in delete enquiry" duration="1"/>
<testCase name="System Status Controller test getResourceUsage method" duration="1"/>
<testCase name="System Status Controller test getProcessInfo method" duration="0"/>
</file>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-ts-sequelize-pg-boilerplate/tests/unit-tests/components/enquiry/EnquiryService.spec.ts">
<testCase name="EnquiryService should return all enquiries" duration="4"/>
<testCase name="EnquiryService should throw error if failed to fetch enquiries" duration="5"/>
<testCase name="EnquiryService should throw error if failed to fetch enquiries" duration="6"/>
<testCase name="EnquiryService should return particular enquiry by id" duration="0"/>
<testCase name="EnquiryService should throw error if failed to fetch empty enquiry by id" duration="2"/>
<testCase name="EnquiryService should throw error if failed to fetch enquiry by id" duration="1"/>
<testCase name="EnquiryService should throw error if failed to fetch enquiry by id" duration="0"/>
<testCase name="EnquiryService should update enquiry with valid input" duration="0"/>
<testCase name="EnquiryService should throw an error if it fails to update as it failed to find the enquiry by id" duration="0"/>
<testCase name="EnquiryService should throw an error if it fails to update" duration="0"/>
<testCase name="EnquiryService should throw an error if it fails to update" duration="1"/>
<testCase name="EnquiryService should create a new enquiry with valid input" duration="0"/>
<testCase name="EnquiryService should throw error if failed to create enquiry" duration="1"/>
<testCase name="EnquiryService should return true if enquiry is deleted successfully" duration="0"/>
<testCase name="EnquiryService should return false if no enquiry is deleted" duration="0"/>
<testCase name="EnquiryService should throw error if failed to create enquiry" duration="0"/>
<testCase name="EnquiryService should return true if enquiry is deleted successfully" duration="2"/>
<testCase name="EnquiryService should return false if no enquiry is deleted" duration="1"/>
<testCase name="EnquiryService should throw error if failed to delete enquiry" duration="1"/>
</file>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-ts-sequelize-pg-boilerplate/tests/unit-tests/components/enquiry/EnquiryController.spec.ts">
<testCase name="Enquiry Controller should register routes and return router" duration="3"/>
<testCase name="Enquiry Controller should get all enquiries" duration="1"/>
<testCase name="Enquiry Controller should handle errors to get all enquiries" duration="0"/>
<testCase name="Enquiry Controller should get details of a specific enquiry" duration="1"/>
<testCase name="Enquiry Controller should handle errors to get all enquiries" duration="1"/>
<testCase name="Enquiry Controller should create enquiry" duration="0"/>
<testCase name="Enquiry Controller should throw BAD_REQUEST error if name and country are not provided" duration="0"/>
<testCase name="Enquiry Controller should handle errors in create enquiry" duration="1"/>
<testCase name="Enquiry Controller should update enquiry" duration="0"/>
<testCase name="Enquiry Controller should handle errors in update enquiry" duration="1"/>
<testCase name="Enquiry Controller should delete enquiry" duration="0"/>
<testCase name="Enquiry Controller should handle errors in delete enquiry" duration="0"/>
</file>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-ts-sequelize-pg-boilerplate/tests/integration-tests/app.integration.spec.ts">
<testCase name="status integration tests can get default route success" duration="12"/>
<testCase name="status integration tests can get default web route success" duration="3"/>
<testCase name="status integration tests can get default web route success" duration="2"/>
</file>
</testExecutions>

0 comments on commit aaf8916

Please sign in to comment.