Skip to content

Commit

Permalink
Add routeVeeam unit tests
Browse files Browse the repository at this point in the history
Issue: CLDSRV-613
  • Loading branch information
williamlardier committed Feb 26, 2025
1 parent a2009ea commit 01e331c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/unit/internal/routeVeeam.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const assert = require('assert');
const { DummyRequestLogger } = require('../helpers');
const routeVeeam = require('../../../lib/routes/routeVeeam');
const DummyRequest = require('../DummyRequest');

const log = new DummyRequestLogger();

Expand Down Expand Up @@ -111,3 +112,25 @@ describe('RouteVeeam: _normalizeVeeamRequest', () => {
assert.doesNotThrow(() => routeVeeam._normalizeVeeamRequest(request));
});
});

describe('RouteVeeam: routeVeeam', () => {
it('should return error for unsupported routes', done => {
const req = new DummyRequest({
method: 'PATCH',
resourceType: 'bucket',
subresource: 'veeam',
apiMethod: 'routeVeeam',
url: '/bucket/veeam',
});
req.method = 'PATCH';
routeVeeam.routeVeeam('127.0.0.1', req, {
setHeader: () => {},
writeHead: () => {},
end: data => {
assert(data.includes('MethodNotAllowed'));
done();
},
headersSent: false,
}, log);
});
});

0 comments on commit 01e331c

Please sign in to comment.