@@ -294,7 +294,9 @@ it("preview domain truncation - valid preview link", async () => {
294294 // check link is valid
295295 expect ( startDocsPreviewResponse . previewUrl ) . toBeDefined ( ) ;
296296 const previewUrl = new URL ( startDocsPreviewResponse . previewUrl ) ;
297- expect ( previewUrl . hostname . length ) . toBeLessThanOrEqual ( 63 ) ;
297+ const subdomains = previewUrl . hostname . split ( "." ) ;
298+ const mainSubdomain = subdomains [ 0 ] ;
299+ expect ( mainSubdomain . length ) . toBeLessThanOrEqual ( 63 ) ;
298300 expect ( previewUrl . hostname ) . toMatch (
299301 / ^ s h o r t - p r e v i e w - [ a - f 0 - 9 - ] + \. d o c s \. b u i l d w i t h f e r n \. c o m $ /
300302 ) ;
@@ -312,7 +314,7 @@ it("preview domain truncation - requires truncation", async () => {
312314
313315 const startDocsPreviewResponse =
314316 await fdr . docs . v2 . write . startDocsPreviewRegister ( {
315- orgId : FdrAPI . OrgId ( "medium-org-name" ) ,
317+ orgId : FdrAPI . OrgId ( "medium-org-name-for-truncation " ) ,
316318 filepaths : [
317319 DocsV1Write . FilePath ( "logo.png" ) ,
318320 DocsV1Write . FilePath ( "guides/guide.mdx" ) ,
@@ -329,9 +331,11 @@ it("preview domain truncation - requires truncation", async () => {
329331 expect ( startDocsPreviewResponse . ok ) . toBe ( true ) ;
330332 if ( startDocsPreviewResponse . ok ) {
331333 const previewUrl = new URL ( startDocsPreviewResponse . body . previewUrl ) ;
332- expect ( previewUrl . hostname . length ) . toBeLessThanOrEqual ( 63 ) ;
334+ const subdomains = previewUrl . hostname . split ( "." ) ;
335+ const mainSubdomain = subdomains [ 0 ] ;
336+ expect ( mainSubdomain . length ) . toBeLessThanOrEqual ( 63 ) ;
333337 expect ( previewUrl . hostname ) . toMatch (
334- / ^ m e d i u m - o r g - n a m e - p r e v i e w - [ a - f 0 - 9 - ] { 8 , } \. d o c s \. b u i l d w i t h f e r n \. c o m $ /
338+ / ^ m e d i u m - o r g - n a m e - f o r - t r u n c a t i o n - p r e v i e w - [ a - f 0 - 9 - ] { 23 , } \. d o c s \. b u i l d w i t h f e r n \. c o m $ /
335339 ) ;
336340 }
337341} ) ;
0 commit comments