-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add comments to automated test files
- Loading branch information
1 parent
3926ea3
commit b3f5436
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,39 @@ | ||
const config = require('../scripts/config'); | ||
const { tcpPingPort } = require("tcp-ping-port") | ||
|
||
/** | ||
* Test enabling the quarantine mode using the configuration manager | ||
* This tests both launching the configuration server and the configuration changer function | ||
*/ | ||
test('Enable quarantine mode', async () => { | ||
let testReturn = await config.changeParam("quarantineInfected", "/usr/VSterilizer/infected/", "./tests/sources/.test.env") | ||
expect(testReturn).toBe("quarantineInfected mode enabled"); | ||
}); | ||
|
||
/** | ||
* Test enabling the removal mode using the configuration manager | ||
* This tests both launching the configuration server and the configuration changer function | ||
*/ | ||
test('Enable remove mode', async () => { | ||
let testReturn = await config.changeParam("removeInfected", "True", "./tests/sources/.test.env") | ||
expect(testReturn).toBe("removeInfected mode enabled"); | ||
}); | ||
|
||
/** | ||
* Test the reachability of the configuration changing API endpoint | ||
* This tests both launching the configuration server and the reachability of it | ||
*/ | ||
test('Check server reachability', async () => { | ||
let res = await tcpPingPort("0.0.0.0", 8080).then(status => { | ||
return status.online; | ||
}) | ||
expect(res).toBe(true); | ||
}); | ||
|
||
/** | ||
* Close the configuration server after all tests are complete | ||
* This tests exiting from the server and creates a graceful exit opportunity | ||
*/ | ||
afterAll(() => { | ||
config.server.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters