Skip to content

Commit

Permalink
Remove assertions checking for email ids from /emails endpoint test
Browse files Browse the repository at this point in the history
Previously the last element of the result array returned from the
/emails endpoint was checked to have the id of the email cloned in
the test case above and the second last element was checked to be
the email created in the first testcase. However on certain runs
they are returned out of order, causing the test to fail unnecessarily.
  • Loading branch information
lckariyawasam committed Jan 3, 2025
1 parent 552fe02 commit 235e9b4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions ballerina/tests/test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,13 @@ public function testRetrieveEmailEp() returns error? {
}


@test:Config{dependsOn: [testCreateEmailEp]}
@test:Config{dependsOn: [testCreateEmailEp, testCloneEmailEp]}
public function testEmailsEp() returns error? {
CollectionResponseWithTotalPublicEmailForwardPaging|error response = hubspotClient->/marketing/v3/emails();

if response is CollectionResponseWithTotalPublicEmailForwardPaging {
test:assertEquals(response.total, response.results.length());

// Check that the newly created email and clone above is included
test:assertEquals(response.results[response.total - 1].id, cloneEmailId);
test:assertEquals(response.results[response.total - 2].id, testEmailId);

} else {
test:assertFail("Failed to get response from /marketing/v3/emails");
}
Expand Down

0 comments on commit 235e9b4

Please sign in to comment.