Update test case for url resolution to make it more specific

This commit is contained in:
om-3004 committed 2024-10-17 16:59:49 +05:30
1 parent cb64d16d69
commit ff6051b6b0
2 files changed
+3 -1

No files matched your search

+1 -1
View File
@@ -264,7 +264,7 @@ const createMonitor = async (req, res, next) => {
};
/**
* Checks if the endpoint can be resolved and adds it to the job queue.
* Checks if the endpoint can be resolved
* @async
* @param {Object} req - The Express request object.
* @property {Object} req.query - The query parameters of the request.
@@ -490,6 +490,7 @@ describe("Monitor Controllor - checkEndpointResolution", () => {
expect(errorPassedToNext).to.be.an.instanceOf(Error);
expect(errorPassedToNext.message).to.include('DNS resolution failed');
expect(errorPassedToNext.code).to.equal('ENOTFOUND');
expect(errorPassedToNext.status).to.equal(500);
});
it('should reject with an error if query validation fails', async () => {
req.query.monitorURL = 'invalid-url';
@@ -498,6 +499,7 @@ describe("Monitor Controllor - checkEndpointResolution", () => {
const error = next.getCall(0).args[0];
expect(next.firstCall.args[0]).to.be.an("error");
expect(next.firstCall.args[0].status).to.equal(422);
expect(error.message).to.equal('"monitorURL" must be a valid uri');
});
});