blob: 65ac7e477327c3c05b31c68faaf02548e61bc9d2 [file] [log] [blame]
Adrià Vilanova Martínez01038b22025-04-05 17:20:01 +02001import { describe, expect, it } from 'vitest';
Adrià Vilanova Martínez9c418ab2024-12-05 15:34:40 +01002import FetchInput from './FetchInput';
3
4describe('FetchInput', () => {
5 describe('getUrl', () => {
6 const urlString = 'https://example.avm99963.com/';
7
8 it('should return input when input is already a string', () => {
9 const dummyInput = urlString;
10
11 const sut = new FetchInput(dummyInput);
12 const result = sut.getUrl();
13
14 expect(result).toBe(urlString);
15 });
16
17 it('should return stringified url when input is a URL instance', () => {
18 const dummyInput = new URL(urlString);
19
20 const sut = new FetchInput(dummyInput);
21 const result = sut.getUrl();
22
23 expect(result).toBe(urlString);
24 });
25
26 it('should return url string when input is a Request instance', () => {
27 const dummyInput = new Request(urlString);
28
29 const sut = new FetchInput(dummyInput);
30 const result = sut.getUrl();
31
32 expect(result).toBe(urlString);
33 });
34 });
35});