File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import assert from "node:assert" ;
2+ import { describe , it } from "node:test" ;
3+ import {
4+ ensureHref ,
5+ githubLabel ,
6+ linkedinLabel ,
7+ websiteLabel ,
8+ } from "../url-helpers" ;
9+
10+ describe ( "url-helpers" , ( ) => {
11+ it ( "keeps http/https URLs unchanged" , ( ) => {
12+ assert . strictEqual ( ensureHref ( "https://example.com" ) , "https://example.com" ) ;
13+ assert . strictEqual ( ensureHref ( "http://example.com" ) , "http://example.com" ) ;
14+ } ) ;
15+
16+ it ( "prefixes protocol for plain hostnames" , ( ) => {
17+ assert . strictEqual ( ensureHref ( "example.com" ) , "https://example.com" ) ;
18+ } ) ;
19+
20+ it ( "maps email-like input to mailto" , ( ) => {
21+ assert . strictEqual ( ensureHref ( "user@example.com" ) , "mailto:user@example.com" ) ;
22+ } ) ;
23+
24+ it ( "returns empty string for empty input" , ( ) => {
25+ assert . strictEqual ( ensureHref ( "" ) , "" ) ;
26+ } ) ;
27+
28+ it ( "returns stable display labels" , ( ) => {
29+ assert . strictEqual ( websiteLabel ( ) , "Portfolio" ) ;
30+ assert . strictEqual ( linkedinLabel ( ) , "LinkedIn" ) ;
31+ assert . strictEqual ( githubLabel ( ) , "GitHub" ) ;
32+ } ) ;
33+ } ) ;
You can’t perform that action at this time.
0 commit comments