blob: 3c20b5bcbbd976b33595b3b36d608024bbcbb676 [file] [log] [blame]
/**
* @jest-environment ./src/xhrInterceptor/fetchProxy/__environments__/fetchEnvironment.ts
*/
import { describe, expect, it } from '@jest/globals';
import FetchInput from './FetchInput';
describe('FetchInput', () => {
describe('getUrl', () => {
const urlString = 'https://example.avm99963.com/';
it('should return input when input is already a string', () => {
const dummyInput = urlString;
const sut = new FetchInput(dummyInput);
const result = sut.getUrl();
expect(result).toBe(urlString);
});
it('should return stringified url when input is a URL instance', () => {
const dummyInput = new URL(urlString);
const sut = new FetchInput(dummyInput);
const result = sut.getUrl();
expect(result).toBe(urlString);
});
it('should return url string when input is a Request instance', () => {
const dummyInput = new Request(urlString);
const sut = new FetchInput(dummyInput);
const result = sut.getUrl();
expect(result).toBe(urlString);
});
});
});