Skip to content

Commit

Permalink
Adding removed unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
rbenhaddou committed Nov 1, 2023
1 parent 0111914 commit f9fb299
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,22 @@ describe("Utils : buildPullRequestComment", () => {

});

it("Given a collection with no tests, return the correct comment", () => {
const expectedResult = `Congratulations, All Tests have Passed! \nPlease find the complete report [here](https://github.com/organization/repo/pull/3/checks?check_run_id=1121312312) \n ✅ 0 / 0 **Requests Passed** \n ❌ 0 / 0 **Requests Failed**\n ⏩ 0 / 0 **Requests Skipped**`;
const assertions = {
failed_count: 0,
skipped_count: 0,
};

const items = [{}];
const report = {assertions, items}
const issueNumber = 3;
const checkRunId = "1121312312";
const result = buildPullRequestComment(report, githubService.options, issueNumber, checkRunId);


expect(result).to.equal(expectedResult);
})

it("Given a collection with depth = 0 that has a passing and failing test return the correct comment", () => {
const expectedResult = 'You have some failing tests \n Please find the complete report [here](https://github.com/organization/repo/pull/3/checks?check_run_id=1121312312) \n ✅ 1 / 2 **Requests Passed** \n ❌ 1 / 2 **Requests Failed**\n ⏩ 0 / 2 **Requests Skipped** \n **The following tests are failing:** \n\n [+] Show one place\n - Status code is 200 , AssertionError , expected response to have status code 200 but got 404 \n'
Expand Down

0 comments on commit f9fb299

Please sign in to comment.