fix eslint errors

This commit is contained in:
Sostene Munezero Bagira 2023-02-07 15:34:56 +02:00
parent ea4e09740d
commit 3fea02df22
No known key found for this signature in database
GPG Key ID: 1334D6A6DF6FB950
11 changed files with 63 additions and 53 deletions

View File

@ -17,6 +17,6 @@ jobs:
- uses: actions/setup-node@v2
with:
check-latest: true
- run: cd Common && npm install
- run: cd Model && npm install && npm run test
- run: cd Model && npm install
- run: cd Common && npm install && npm run test

View File

@ -1,9 +1,13 @@
import ErrorResponse from '../../../Types/API/HTTPErrorResponse';
describe('ErrorResponse', () => {
test('should return a valid error response object', () => {
const errorResponseObject: ErrorResponse = new ErrorResponse(500, {
error: 'Internal Server Error',
},{});
const errorResponseObject: ErrorResponse = new ErrorResponse(
500,
{
error: 'Internal Server Error',
},
{}
);
expect(errorResponseObject.statusCode).toBe(500);
expect(errorResponseObject.data).toEqual({
error: 'Internal Server Error',

View File

@ -3,9 +3,13 @@ import { JSONObject } from '../../../Types/JSON';
describe('Response()', () => {
test('should return a valid response object', () => {
const responseObject: Response<JSONObject> = new Response(200, {
welcome: 'here',
},{});
const responseObject: Response<JSONObject> = new Response(
200,
{
welcome: 'here',
},
{}
);
expect(responseObject.statusCode).toBe(200);
expect(responseObject.data).toEqual({ welcome: 'here' });
const responseObjectArray: Response<Array<JSONObject>> = new Response<

View File

@ -1,37 +1,49 @@
import AlertEventType from '../../../Types/Alerts/AlertEventType';
describe('AlertEventType', () => {
test('AlertEventType.Identified to be Identified', () => {
expect(AlertEventType.Identified).toBe('Identified');
});
test('AlertEventType.Acknowledged to Acknowledged', () => {
expect(AlertEventType.Acknowledged).toBe('Acknowledged');
});
});
test('AlertEventType.Resolved to Resolved', () => {
expect(AlertEventType.Resolved).toBe('Resolved');
});
});
test('AlertEventType.InvestigationNoteCreated to Investigation note created', () => {
expect(AlertEventType.InvestigationNoteCreated).toBe('Investigation note created');
});
expect(AlertEventType.InvestigationNoteCreated).toBe(
'Investigation note created'
);
});
test('AlertEventType.InvestigationNoteUpdated to Investigation note updated', () => {
expect(AlertEventType.InvestigationNoteUpdated).toBe('Investigation note updated');
});
expect(AlertEventType.InvestigationNoteUpdated).toBe(
'Investigation note updated'
);
});
test('AlertEventType.ScheduledMaintenanceCreated to Scheduled maintenance created', () => {
expect(AlertEventType.ScheduledMaintenanceCreated).toBe('Scheduled maintenance created');
});
expect(AlertEventType.ScheduledMaintenanceCreated).toBe(
'Scheduled maintenance created'
);
});
test('AlertEventType.ScheduledMaintenanceNoteCreated to Scheduled maintenance note Created', () => {
expect(AlertEventType.ScheduledMaintenanceNoteCreated).toBe('Scheduled maintenance note created');
});
expect(AlertEventType.ScheduledMaintenanceNoteCreated).toBe(
'Scheduled maintenance note created'
);
});
test('AlertEventType.ScheduledMaintenanceResolved to sheduled mantainance resolved', () => {
expect(AlertEventType.ScheduledMaintenanceResolved).toBe('Scheduled maintenance resolved');
});
expect(AlertEventType.ScheduledMaintenanceResolved).toBe(
'Scheduled maintenance resolved'
);
});
test('AlertEventType.Acknowledged to Scheduled maintenance cancelled', () => {
expect(AlertEventType.ScheduledMaintenanceCancelled).toBe('Scheduled maintenance cancelled');
});
expect(AlertEventType.ScheduledMaintenanceCancelled).toBe(
'Scheduled maintenance cancelled'
);
});
test('AlertEventType.AnnouncementNotificationCreated to Announcement notification created', () => {
expect(AlertEventType.AnnouncementNotificationCreated).toBe('Announcement notification created');
});
expect(AlertEventType.AnnouncementNotificationCreated).toBe(
'Announcement notification created'
);
});
});

View File

@ -1,23 +1,19 @@
import AlertType from '../../../Types/Alerts/AlertType';
describe('AlertType', () => {
test('AlertType.Email to be Email', () => {
expect(AlertType.Webhook).toBe('Webhook');
});
test('AlertType.Acknowledged to Acknowledged', () => {
expect(AlertType.Email).toBe('Email');
});
});
test('AlertType.SMS to SMS', () => {
expect(AlertType.SMS).toBe('SMS');
});
});
test('AlertType.Call to Call', () => {
expect(AlertType.Call).toBe('Call');
});
});
test('AlertType.PushNotification to PushNotification', () => {
expect(AlertType.PushNotification).toBe('PushNotification');
});
});
});

View File

@ -1,16 +1,13 @@
import ApplicationLogType from '../../../Types/ApplicationLog/ApplicationLogType';
describe('ApplicationLogType', () => {
test('ApplicationLogType.Info to be Info', () => {
expect(ApplicationLogType.Info).toBe('Info');
});
test('ApplicationLogType.Error to Error', () => {
expect(ApplicationLogType.Error).toBe('Error');
});
});
test('ApplicationLogType.Warning to Warning', () => {
expect(ApplicationLogType.Warning).toBe('Warning');
});
});
});

View File

@ -1,16 +1,13 @@
import ApplicationLogType from '../../../Types/ApplicationLog/ApplicationLogType';
describe('ApplicationLogType', () => {
test('ApplicationLogType.Info to be Info', () => {
expect(ApplicationLogType.Info).toBe('Info');
});
test('ApplicationLogType.Error to Error', () => {
expect(ApplicationLogType.Error).toBe('Error');
});
});
test('ApplicationLogType.Warning to Warning', () => {
expect(ApplicationLogType.Warning).toBe('Warning');
});
});
});

View File

@ -2,7 +2,7 @@ import LIMIT_MAX, { LIMIT_PER_PROJECT } from '../../../Types/Database/LimitMax';
describe('LIMIT_MAX', () => {
test('it should be number', () => {
expect(typeof LIMIT_MAX).toBe("number")
expect(typeof LIMIT_MAX).toBe('number');
});
});
@ -14,7 +14,7 @@ describe('LIMIT_MAX', () => {
describe('LIMIT_PER_PROJECT', () => {
test('should be positive number', () => {
expect(typeof LIMIT_PER_PROJECT).toBe("number")
expect(LIMIT_PER_PROJECT).toBeGreaterThan(0)
expect(typeof LIMIT_PER_PROJECT).toBe('number');
expect(LIMIT_PER_PROJECT).toBeGreaterThan(0);
});
});

View File

@ -6,7 +6,7 @@ describe('Email()', () => {
});
test('should not create an email with invalid credentials', () => {
let invalidEmail='invalid email address'
const invalidEmail: string = 'invalid email address';
expect(() => {
new Email(invalidEmail);
}).toThrow(`Email ${invalidEmail} is not in valid format.`);

View File

@ -23,8 +23,8 @@ describe('Testing Class Phone', () => {
});
test('try to mutating Phone.phone with invalid value should throw an BadDataExcepection', () => {
let valid='+251912974103'
let invalid='278@$90> '
const valid: string = '+251912974103';
const invalid: string = '278@$90> ';
const value: Phone = new Phone(valid);
expect(() => {
value.phone = invalid;
@ -32,7 +32,7 @@ describe('Testing Class Phone', () => {
expect(() => {
value.phone = '278@$90> ';
}).toThrow('Phone is not in valid format: 278@$90>');
expect(value.phone).toBe(valid)
expect(value.phone).toBe(valid);
expect(() => {
value.phone = 'hgjuit879';
}).toThrowError(BadDataException);

View File

@ -2,7 +2,7 @@ enum CodeType {
JavaScript = 'JavaScript',
CSS = 'CSS',
HTML = 'HTML',
// TODO add more mime types.
}