Skip to content

Commit

Permalink
fixed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
santoshshinde2012 committed Mar 3, 2024
1 parent 8ba51f7 commit 27f1136
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 144 deletions.
202 changes: 104 additions & 98 deletions coverage/lcov.info
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,64 @@ FN:77,(anonymous_5)
FN:84,(anonymous_6)
FNF:6
FNH:6
FNDA:3,(anonymous_1)
FNDA:3,(anonymous_2)
FNDA:3,(anonymous_3)
FNDA:2,(anonymous_1)
FNDA:2,(anonymous_2)
FNDA:2,(anonymous_3)
FNDA:1,(anonymous_4)
FNDA:2,(anonymous_5)
FNDA:3,(anonymous_6)
DA:1,3
DA:2,3
DA:3,3
DA:4,3
DA:5,3
DA:6,3
DA:7,3
DA:8,3
DA:9,3
DA:11,3
DA:17,3
DA:18,3
DA:21,3
DA:24,3
DA:27,3
DA:30,3
DA:31,3
DA:39,3
DA:40,3
DA:41,3
DA:51,3
DA:52,3
DA:53,3
DA:57,3
DA:64,3
FNDA:2,(anonymous_6)
DA:1,2
DA:2,2
DA:3,2
DA:4,2
DA:5,2
DA:6,2
DA:7,2
DA:8,2
DA:9,2
DA:11,2
DA:17,2
DA:18,2
DA:21,2
DA:24,2
DA:27,2
DA:30,2
DA:31,2
DA:39,2
DA:40,2
DA:41,2
DA:51,2
DA:52,2
DA:53,2
DA:57,2
DA:64,2
DA:74,1
DA:81,2
DA:85,3
DA:85,2
LF:28
LH:28
BRDA:30,0,0,3
BRDA:30,0,0,2
BRF:1
BRH:1
end_of_record
TN:
SF:src/routes.ts
FN:8,registerRoutes
FNF:1
FNH:1
FNDA:3,registerRoutes
DA:1,3
DA:2,3
DA:8,3
DA:9,3
DA:13,3
DA:14,3
DA:16,3
LF:7
LH:7
FN:16,(anonymous_2)
FNF:2
FNH:2
FNDA:2,registerRoutes
FNDA:2,(anonymous_2)
DA:1,2
DA:2,2
DA:8,2
DA:9,2
DA:11,2
DA:16,2
DA:18,2
DA:21,2
LF:8
LH:8
BRF:0
BRH:0
end_of_record
Expand All @@ -78,7 +81,7 @@ DA:20,2
DA:21,2
DA:22,2
DA:23,2
DA:27,4
DA:27,3
LF:7
LH:7
BRDA:19,0,0,2
Expand All @@ -91,13 +94,13 @@ FN:11,(anonymous_1)
FN:22,(anonymous_2)
FNF:2
FNH:2
FNDA:4,(anonymous_1)
FNDA:3,(anonymous_1)
FNDA:6,(anonymous_2)
DA:1,4
DA:2,4
DA:3,4
DA:8,4
DA:12,4
DA:1,3
DA:2,3
DA:3,3
DA:8,3
DA:12,3
DA:23,6
DA:24,6
DA:25,6
Expand All @@ -114,62 +117,65 @@ BRH:4
end_of_record
TN:
SF:src/components/system-status/system-status.controller.ts
FN:21,(anonymous_7)
FN:36,(anonymous_8)
FN:67,(anonymous_9)
FN:85,(anonymous_10)
FN:112,(anonymous_11)
FN:146,(anonymous_12)
FNF:6
FNH:6
FN:17,(anonymous_7)
FN:23,(anonymous_8)
FN:38,(anonymous_9)
FN:69,(anonymous_10)
FN:87,(anonymous_11)
FN:114,(anonymous_12)
FN:148,(anonymous_13)
FNF:7
FNH:7
FNDA:3,(anonymous_7)
FNDA:4,(anonymous_8)
FNDA:2,(anonymous_9)
FNDA:3,(anonymous_10)
FNDA:2,(anonymous_8)
FNDA:4,(anonymous_9)
FNDA:2,(anonymous_10)
FNDA:3,(anonymous_11)
FNDA:3,(anonymous_12)
DA:2,4
DA:3,4
DA:4,4
DA:5,4
DA:6,4
DA:17,4
DA:22,3
DA:23,3
DA:24,3
DA:25,3
DA:26,3
DA:27,3
DA:41,4
DA:42,4
DA:53,4
FNDA:3,(anonymous_13)
DA:2,3
DA:3,3
DA:4,3
DA:5,3
DA:6,3
DA:17,3
DA:19,3
DA:24,2
DA:25,2
DA:26,2
DA:27,2
DA:28,2
DA:29,2
DA:43,4
DA:44,4
DA:55,4
DA:57,3
DA:68,2
DA:69,2
DA:75,2
DA:90,3
DA:91,3
DA:57,4
DA:59,3
DA:70,2
DA:71,2
DA:77,2
DA:92,3
DA:95,3
DA:99,3
DA:100,3
DA:102,2
DA:117,3
DA:118,3
DA:93,3
DA:94,3
DA:97,3
DA:101,3
DA:102,3
DA:104,2
DA:119,3
DA:120,3
DA:121,3
DA:122,3
DA:133,3
DA:134,3
DA:136,2
DA:151,3
DA:152,3
DA:161,3
DA:162,3
DA:164,2
LF:40
LH:40
DA:124,3
DA:135,3
DA:136,3
DA:138,2
DA:153,3
DA:154,3
DA:163,3
DA:164,3
DA:166,2
LF:41
LH:41
BRF:0
BRH:0
end_of_record
Expand Down
2 changes: 2 additions & 0 deletions src/components/system-status/system-status.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
* Status controller
*/
export default class SystemStatusController extends BaseApi {

public basePath: string = 'system';
/**
*
*/
Expand Down
13 changes: 9 additions & 4 deletions src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ import SystemStatusController from './components/system-status/system-status.con
export default function registerRoutes(): Router {
const router = Router();

// System Status Controller
const systemStatusController: SystemStatusController =
new SystemStatusController();
router.use('/system', systemStatusController.register());
const controllers = [
new SystemStatusController(),
];

// Dynamically register routes for each controller
controllers.forEach((controller) => {
// make sure each controller has basePath attribute and register() method
router.use(`/v1/${controller.basePath}`, controller.register());
});

return router;
}
56 changes: 28 additions & 28 deletions test-report.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<testExecutions version="1">
<file path="/Users/santosh/Documents/workspace/personal/node-boilerplate/tests/unit-tests/dummy.spec.ts">
<testCase name="Dummy Test Cases Verify Jest is working" duration="3"/>
</file>
<file path="/Users/santosh/Documents/workspace/personal/node-boilerplate/tests/unit-tests/lib/crypto.spec.ts">
<testCase name="Crypto Lib (Encryption/Decryption) Testing for text" duration="7"/>
<testCase name="Crypto Lib (Encryption/Decryption) Testing for array" duration="1"/>
<testCase name="Crypto Lib (Encryption/Decryption) Testing for object" duration="1"/>
</file>
<file path="/Users/santosh/Documents/workspace/personal/node-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="9"/>
</file>
<file path="/Users/santosh/Documents/workspace/personal/node-boilerplate/tests/unit-tests/components/SystemStatusController.spec.ts">
<testCase name="System Status Controller test getError method" duration="3"/>
<testCase name="System Status Controller test getSystemInfo method" duration="3"/>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-boilerplate/tests/unit-tests/components/SystemStatusController.spec.ts">
<testCase name="System Status Controller test getError method" duration="2"/>
<testCase name="System Status Controller test getSystemInfo method" duration="6"/>
<testCase name="System Status Controller test getSystemInfo method with updated env variables" duration="2"/>
<testCase name="System Status Controller test getSystemInfo method with exception" duration="0"/>
<testCase name="System Status Controller test getServerTime method" duration="1"/>
<testCase name="System Status Controller test getServerTime method" duration="2"/>
<testCase name="System Status Controller test getServerTime method with exception" duration="0"/>
<testCase name="System Status Controller test getResourceUsage method" duration="0"/>
<testCase name="System Status Controller test getResourceUsage method with exception" duration="1"/>
<testCase name="System Status Controller test getResourceUsage method" duration="1"/>
<testCase name="System Status Controller test getResourceUsage method with exception" duration="0"/>
<testCase name="System Status Controller test getProcessInfo method" duration="0"/>
<testCase name="System Status Controller test getProcessInfo method with exception" duration="0"/>
</file>
<file path="/Users/santosh/Documents/workspace/personal/node-boilerplate/tests/unit-tests/middleware/error-handler.spec.ts">
<testCase name="ErrorHandler middleware with 0 status code" duration="4"/>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-boilerplate/tests/integration-tests/app.integration.spec.ts">
<testCase name="status integration tests can get default route success" duration="16"/>
<testCase name="status integration tests can get default web route success" duration="3"/>
</file>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-boilerplate/tests/unit-tests/dummy.spec.ts">
<testCase name="Dummy Test Cases Verify Jest is working" duration="3"/>
</file>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-boilerplate/tests/unit-tests/lib/crypto.spec.ts">
<testCase name="Crypto Lib (Encryption/Decryption) Testing for text" duration="5"/>
<testCase name="Crypto Lib (Encryption/Decryption) Testing for array" duration="2"/>
<testCase name="Crypto Lib (Encryption/Decryption) Testing for object" duration="2"/>
</file>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-boilerplate/tests/unit-tests/middleware/error-handler.spec.ts">
<testCase name="ErrorHandler middleware with 0 status code" duration="5"/>
<testCase name="ErrorHandler middleware with 200 status code" duration="0"/>
<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="1"/>
<testCase name="ErrorHandler middleware with 200 status code and updated env variables" duration="2"/>
</file>
<file path="/Users/santosh/Documents/workspace/personal/node-boilerplate/tests/integration-tests/app.integration.spec.ts">
<testCase name="status integration tests can get default route success" duration="20"/>
<testCase name="status integration tests can get default web route success" duration="2"/>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-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="7"/>
</file>
<file path="/Users/santosh/Documents/workspace/personal/node-boilerplate/tests/integration-tests/status.integration.spec.ts">
<testCase name="status integration tests can get server time" duration="20"/>
<testCase name="status integration tests can get server system info" duration="5"/>
<file path="/Users/santosh/Documents/workspace/boilerplates/node-boilerplate/tests/integration-tests/status.integration.spec.ts">
<testCase name="status integration tests can get server time" duration="18"/>
<testCase name="status integration tests can get server system info" duration="4"/>
<testCase name="status integration tests can get server system usage" duration="2"/>
<testCase name="status integration tests can get server system process info" duration="2"/>
<testCase name="status integration tests should get the error" duration="4"/>
<testCase name="status integration tests should get the error" duration="3"/>
</file>
</testExecutions>
Loading

0 comments on commit 27f1136

Please sign in to comment.