Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
myrotvorets-team committed Sep 30, 2023
1 parent 6447161 commit 6505e57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 5 additions & 2 deletions test/functional/controllers/monitoring.test.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import express, { type Express } from 'express';
import { expect } from 'chai';
import request from 'supertest';
import type { HealthChecker } from '@cloudnative/health-connect';
import { healthChecker, monitoringController } from '../../../src/controllers/monitoring.mjs';

describe('MonitoringController', function () {
Expand All @@ -12,7 +14,8 @@ describe('MonitoringController', function () {
});

beforeEach(function () {
healthChecker.shutdownRequested = false;
expect(healthChecker).not.to.be.undefined;
(healthChecker as HealthChecker).shutdownRequested = false;
});

afterEach(function () {
Expand All @@ -23,7 +26,7 @@ describe('MonitoringController', function () {
request(app).get(`/monitoring/${endpoint}`).expect('Content-Type', /json/u).expect(200);

const checker503 = (endpoint: string): Promise<unknown> => {
healthChecker.shutdownRequested = true;
(healthChecker as HealthChecker).shutdownRequested = true;
return request(app).get(`/monitoring/${endpoint}`).expect('Content-Type', /json/u).expect(503);
};

Expand Down
9 changes: 5 additions & 4 deletions test/unit/services/fixtures.mts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Readable } from 'node:stream';
import type { RawResponse } from '@myrotvorets/facex';

export const fakeFile: Express.Multer.File = {
Expand All @@ -6,7 +7,7 @@ export const fakeFile: Express.Multer.File = {
encoding: 'binary',
mimetype: 'video/mp4',
size: 1048576,
stream: null,
stream: new Readable(),
destination: '/tmp',
filename: 'test.mp4',
path: '',
Expand Down Expand Up @@ -113,7 +114,7 @@ export const failedVideoResult: RawResponse = {
client_id: 'facex/node',
reqID_serv: '00000000-0000-0000-0000-000000000000',
reqID_clnt: clientGUID,
segment: null,
segment: '',
datetime: Date.now().toString(),
result_code: -1,
results_amount: 0,
Expand All @@ -130,7 +131,7 @@ export const emptyVideoResult: RawResponse = {
client_id: 'facex/node',
reqID_serv: '00000000-0000-0000-0000-000000000000',
reqID_clnt: clientGUID,
segment: null,
segment: '',
datetime: Date.now().toString(),
result_code: 3,
results_amount: 0,
Expand All @@ -147,7 +148,7 @@ export const successfulVideoResult = (data: string): RawResponse => ({
client_id: 'facex/node',
reqID_serv: '00000000-0000-0000-0000-000000000000',
reqID_clnt: clientGUID,
segment: null,
segment: '',
datetime: Date.now().toString(),
result_code: 3,
results_amount: 0,
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"declaration": false,
"removeComments": false,
"strict": true,
"strictNullChecks": false,
"noUnusedLocals": true,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true,
Expand Down

0 comments on commit 6505e57

Please sign in to comment.