2024-07-26 14:54:44 +02:00
|
|
|
const { configureRequest } = require('../../src/ipc/network/index');
|
2023-12-01 22:30:26 +01:00
|
|
|
|
2024-07-26 14:54:44 +02:00
|
|
|
describe('index: configureRequest', () => {
|
|
|
|
it("Should add 'http://' to the URL if no protocol is specified", async () => {
|
|
|
|
const request = { method: 'GET', url: 'test-domain', body: {} };
|
|
|
|
await configureRequest(null, request, null, null, null, null);
|
|
|
|
expect(request.url).toEqual('http://test-domain');
|
2023-12-01 22:30:26 +01:00
|
|
|
});
|
2023-11-30 01:16:37 +01:00
|
|
|
|
2024-07-26 14:54:44 +02:00
|
|
|
it("Should NOT add 'http://' to the URL if a protocol is specified", async () => {
|
|
|
|
const request = { method: 'GET', url: 'ftp://test-domain', body: {} };
|
|
|
|
await configureRequest(null, request, null, null, null, null);
|
|
|
|
expect(request.url).toEqual('ftp://test-domain');
|
|
|
|
});
|
|
|
|
});
|