@@ -19,7 +19,22 @@ describe("validateDesktopPreviewUrl", () => {
1919 } ) ;
2020 } ) ;
2121
22- it ( "rejects missing, malformed, or remote URLs" , ( ) => {
22+ it ( "accepts https and remote http URLs" , ( ) => {
23+ expect ( validateDesktopPreviewUrl ( "https://localhost:3000" ) ) . toEqual ( {
24+ ok : true ,
25+ url : "https://localhost:3000/" ,
26+ } ) ;
27+ expect ( validateDesktopPreviewUrl ( "http://example.com:3000" ) ) . toEqual ( {
28+ ok : true ,
29+ url : "http://example.com:3000/" ,
30+ } ) ;
31+ expect ( validateDesktopPreviewUrl ( "http://localhost" ) ) . toEqual ( {
32+ ok : true ,
33+ url : "http://localhost/" ,
34+ } ) ;
35+ } ) ;
36+
37+ it ( "rejects missing, malformed, or non-http URLs" , ( ) => {
2338 expect ( validateDesktopPreviewUrl ( "" ) ) . toEqual ( {
2439 ok : false ,
2540 error : {
@@ -34,25 +49,11 @@ describe("validateDesktopPreviewUrl", () => {
3449 message : "Preview URL is not a valid URL." ,
3550 } ,
3651 } ) ;
37- expect ( validateDesktopPreviewUrl ( "https://localhost:3000" ) ) . toEqual ( {
38- ok : false ,
39- error : {
40- code : "non-local-url" ,
41- message : "Preview only supports local http URLs." ,
42- } ,
43- } ) ;
44- expect ( validateDesktopPreviewUrl ( "http://example.com:3000" ) ) . toEqual ( {
45- ok : false ,
46- error : {
47- code : "non-local-url" ,
48- message : "Preview only supports localhost, 127.0.0.1, or ::1." ,
49- } ,
50- } ) ;
51- expect ( validateDesktopPreviewUrl ( "http://localhost" ) ) . toEqual ( {
52+ expect ( validateDesktopPreviewUrl ( "ftp://localhost:3000" ) ) . toEqual ( {
5253 ok : false ,
5354 error : {
5455 code : "invalid-url" ,
55- message : "Preview URL must include an explicit port ." ,
56+ message : "Preview only supports http and https URLs ." ,
5657 } ,
5758 } ) ;
5859 } ) ;
0 commit comments