blob: 65ac7e477327c3c05b31c68faaf02548e61bc9d2 [file] [log] [blame]
import { describe, expect, it } from 'vitest';
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);
});
});
});