Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Commit

Permalink
Add unit test for failed request case
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhawk-TA committed Mar 20, 2021
1 parent 1f02671 commit 5ae8b74
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,17 @@ describe("The main module", function() {
assert.strictEqual(err.toString(), sExpectedError, "The correct error message is returned.");
});
});

it("Rejects the promise with an error if get request fails", function() {
//Arrange
let sPlaylistUrl = "some invalid url",
sExpectedError = "Error: connect ECONNREFUSED 127.0.0.1:80";

//Act
return amply.getPlaylist(sPlaylistUrl).catch(err => {
//Assert
assert.strictEqual(err.toString(), sExpectedError, "The correct error message is returned.");
});
});
});
});

0 comments on commit 5ae8b74

Please sign in to comment.