From 9e30bec7f82959790669e775d8efd99e42f3e9f4 Mon Sep 17 00:00:00 2001 From: Okiki Ojo Date: Wed, 22 Apr 2026 02:44:14 -0400 Subject: [PATCH] chore: add URI acceptance and rejection fixtures for testing Signed-off-by: Okiki Ojo --- _test_utils/uri_fixtures.ts | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 _test_utils/uri_fixtures.ts diff --git a/_test_utils/uri_fixtures.ts b/_test_utils/uri_fixtures.ts new file mode 100644 index 0000000..5702268 --- /dev/null +++ b/_test_utils/uri_fixtures.ts @@ -0,0 +1,67 @@ +export type UriAcceptanceFixture = { + input: string; + url: string; +}; + +export const BARE_URI_ACCEPTANCE_FIXTURES: readonly UriAcceptanceFixture[] = [ + { + input: 'Visit https://example.com now', + url: 'https://example.com', + }, + { + input: 'Open file:///Users/example/report.txt now', + url: 'file:///Users/example/report.txt', + }, + { + input: 'Contact mailto:editor@example.org next', + url: 'mailto:editor@example.org', + }, + { + input: 'Catalog urn:isbn:0451450523 now', + url: 'urn:isbn:0451450523', + }, + { + input: 'Call tel:+12025550123 next', + url: 'tel:+12025550123', + }, + { + input: 'Load data:text/plain,hello now', + url: 'data:text/plain,hello', + }, + { + input: 'Fetch magnet:?xt=urn:btih:abcdef now', + url: 'magnet:?xt=urn:btih:abcdef', + }, + { + input: 'Launch foo+bar://example.service/path now', + url: 'foo+bar://example.service/path', + }, +] as const; + +export const BARE_URI_REJECTION_FIXTURES: readonly string[] = [ + 'Reminder: check the corpus matrix', + 'note:abc', + 'chapter:one', + 'longcustomscheme:alpha', + 'abchttps://example.com', + 'Visit https://', +] as const; + +export const EXPLICIT_URI_ACCEPTANCE_FIXTURES: readonly UriAcceptanceFixture[] = [ + { + input: '[https://example.com Example]', + url: 'https://example.com', + }, + { + input: '[http://[::1]:5000/connect/token Loopback]', + url: 'http://[::1]:5000/connect/token', + }, + { + input: '[longcustomscheme:alpha Label]', + url: 'longcustomscheme:alpha', + }, + { + input: '[note:abc Label]', + url: 'note:abc', + }, +] as const; \ No newline at end of file -- 2.51.2