Public
URLReceiver
Script
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { URLReceiver } from "https://esm.town/v/willthereader/urlReceiver";
import { expect } from "jsr:@std/expect";
console.log("Starting URL Receiver test execution");
// Store test URLs in an array for easy maintenance
const TEST_URLS = [
"https://willkrouse.com",
"https://dateme.directory",
];
// Store test inputs that will be applied to each test URL
const TEST_MODIFICATIONS = {
withHTTP: (url: string) => url.replace("https://", "http://"),
withFTP: (url: string) => url.replace("https://", "ftp://"),
withoutProtocol: (url: string) => url.replace("https://", ""),
empty: () => "",
};
interface TestCase {
description: string;
inputs: Record<string, unknown>;
expectedResult: unknown;
function: Function;
}
const urlReceiver = new URLReceiver();
// Create test cases by combining URLs with modifications
function createURLTests(): TestCase[] {
const tests: TestCase[] = [];
TEST_URLS.forEach(baseURL => {
tests.push({
description: `validate HTTPS URL: ${baseURL}`,
inputs: { url: baseURL },