Skip to content

Commit 4e4e0a9

Browse files
committed
Changes to actions yml files
1 parent b1df9b9 commit 4e4e0a9

File tree

6 files changed

+81
-2
lines changed

6 files changed

+81
-2
lines changed

API/deleteRepoApi.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ async function deleteRepoApi(repoId) {
2424
const fileContent = JSON.parse(data.toString());
2525

2626
if (fileContent && fileContent.length > 0) {
27-
let updatedData = fileContent.filter(({ id, repoName, repoPath }) => {
27+
let updatedData = fileContent.filter(({ id }) => {
2828
if (id.toString() === repoId.toString()) {
29-
console.log("REPO DELETED");
3029
return false;
3130
}
3231

jsConfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"typeAcquisition": {
3+
"include": [
4+
"jest"
5+
]
6+
}
7+
}

tests/addRepoApi.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const { addRepoHandler } = require("../API/addRepoApi");
2+
3+
describe("Test module for - addRepoApi", () => {
4+
it("Tests Add repo without init and clone", async () => {
5+
const addRepoResult = await addRepoHandler("JEST_REPO", ".", false, false, "");
6+
7+
expect(addRepoResult).toBeTruthy();
8+
expect(addRepoResult.repoId).toBeTruthy();
9+
expect(addRepoResult.message).toBe("REPO_DATA_UPDATED");
10+
});
11+
12+
it("Tests Add repo feature for negative scenario", async () => {
13+
const addRepoResult = await addRepoHandler("JEST_REPO", "/test", false, false, "");
14+
15+
expect(addRepoResult).toBeTruthy();
16+
expect(addRepoResult.message).toBe("REPO_WRITE_FAILED");
17+
})
18+
});

tests/deleteRepoApi.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const { deleteRepoApi } = require("../API/deleteRepoApi");
2+
const { fetchRepoHandler } = require("../API/fetchRepoApi");
3+
4+
let repoIdList = [];
5+
6+
describe("Test module for - deleteRepoApi", () => {
7+
it("Tests repo deletion scenario", async () => {
8+
const fetchResults = await fetchRepoHandler().then((res) => res);
9+
repoIdList = await fetchResults.repoName.map((name, index) => {
10+
if (name === "JEST_REPO") {
11+
return fetchResults.repoId[index];
12+
} else {
13+
return null;
14+
}
15+
});
16+
17+
let selectedId = "";
18+
19+
repoIdList.forEach((item) => {
20+
if (item) {
21+
selectedId = item;
22+
}
23+
});
24+
const { status } = await deleteRepoApi(selectedId);
25+
26+
expect(status).toBe("DELETE_SUCCESS");
27+
});
28+
});

tests/fetchRepoApi.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { fetchRepoHandler } = require("../API/fetchRepoApi");
2+
3+
test("Test module for - fetchRepoApi", async () => {
4+
const repoDetails = await fetchRepoHandler();
5+
expect(repoDetails).toBeTruthy();
6+
7+
expect(repoDetails.repoId.length).toBeGreaterThan(0);
8+
expect(repoDetails.repoName.length).toBeGreaterThan(0);
9+
expect(repoDetails.repoPath.length).toBeGreaterThan(0);
10+
});

tests/healthCheckApi.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const { healthCheckHandler } = require("../API/healthcheckApi");
2+
3+
test("Test module for - healthCheckApi", async () => {
4+
let { osCheck, gitCheck, nodeCheck } = await healthCheckHandler();
5+
6+
osCheck = JSON.parse(osCheck);
7+
nodeCheck = JSON.parse(nodeCheck);
8+
gitCheck = JSON.parse(gitCheck);
9+
10+
expect(osCheck).toBeTruthy();
11+
expect(gitCheck).toBeTruthy();
12+
expect(nodeCheck).toBeTruthy();
13+
14+
expect(osCheck.status.includes("PASSED")).toBeTruthy();
15+
expect(gitCheck.status.includes("PASSED")).toBeTruthy();
16+
expect(nodeCheck.status.includes("PASSED")).toBeTruthy();
17+
});

0 commit comments

Comments
 (0)