Skip to content

Commit

Permalink
cy: improve api comments & contacts assertions and readability (#1604)
Browse files Browse the repository at this point in the history
* cy: improve api comments & contacts assertions and readability

* remove assertion
  • Loading branch information
artshllk authored Dec 23, 2024
1 parent 8319a37 commit 6f96b25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions cypress/tests/api/api-comments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ describe("Comments API", function () {

context("GET /comments/:transactionId", function () {
it("gets a list of comments for a transaction", function () {
cy.request("GET", `${apiComments}/${ctx.transactionId}`).then((response) => {
const transactionId = ctx.transactionId!;
cy.request("GET", `${apiComments}/${transactionId}`).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.comments.length).to.eq(1);
expect(response.body.comments).to.be.an("array").that.has.length(1);
});
});
});

context("POST /comments/:transactionId", function () {
it("creates a new comment for a transaction", function () {
cy.request("POST", `${apiComments}/${ctx.transactionId}`, {
const transactionId = ctx.transactionId!;
cy.request("POST", `${apiComments}/${transactionId}`, {
content: "This is my comment",
}).then((response) => {
expect(response.status).to.eq(200);
Expand Down
2 changes: 1 addition & 1 deletion cypress/tests/api/api-contacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("Contacts API", function () {
},
}).then((response) => {
expect(response.status).to.eq(422);
expect(response.body.errors.length).to.eq(1);
expect(response.body.errors).to.be.an("array").that.has.length(1);
});
});
});
Expand Down

0 comments on commit 6f96b25

Please sign in to comment.