11import { describe , expect , it } from 'bun:test' ;
2- import {
3- createLinker ,
4- linkerForPublishedURL ,
5- linkerWithAbsoluteURLs ,
6- linkerWithOtherSpaceBasePath ,
7- } from './links' ;
2+ import { createLinker , linkerForPublishedURL , linkerWithAbsoluteURLs } from './links' ;
83
94const root = createLinker ( {
105 host : 'docs.company.com' ,
@@ -122,9 +117,9 @@ describe('linkerWithAbsoluteURLs', () => {
122117 } ) ;
123118} ) ;
124119
125- describe ( 'linkerWithOtherSpaceBasePath ' , ( ) => {
120+ describe ( 'linker.withOtherSiteSpace ' , ( ) => {
126121 it ( 'should return a new linker that resolves links relative to a new spaceBasePath in the current site' , ( ) => {
127- const otherSpaceBasePathLinker = linkerWithOtherSpaceBasePath ( root , {
122+ const otherSpaceBasePathLinker = root . withOtherSiteSpace ( {
128123 spaceBasePath : '/section/variant' ,
129124 } ) ;
130125 expect ( otherSpaceBasePathLinker . toPathInSpace ( 'some/path' ) ) . toBe (
@@ -133,7 +128,7 @@ describe('linkerWithOtherSpaceBasePath', () => {
133128 } ) ;
134129
135130 it ( 'should return a new linker that resolves links relative to a new spaceBasePath in the current site' , ( ) => {
136- const otherSpaceBasePathLinker = linkerWithOtherSpaceBasePath ( root , {
131+ const otherSpaceBasePathLinker = root . withOtherSiteSpace ( {
137132 spaceBasePath : '/section/variant' ,
138133 } ) ;
139134 expect ( otherSpaceBasePathLinker . toPathInSpace ( 'some/path' ) ) . toBe (
@@ -142,14 +137,14 @@ describe('linkerWithOtherSpaceBasePath', () => {
142137 } ) ;
143138
144139 it ( 'should use a basepath relative to the site' , ( ) => {
145- const otherSpaceBasePathLinker = linkerWithOtherSpaceBasePath ( siteGitBookIO , {
140+ const otherSpaceBasePathLinker = siteGitBookIO . withOtherSiteSpace ( {
146141 spaceBasePath : 'a/b' ,
147142 } ) ;
148143 expect ( otherSpaceBasePathLinker . toPathInSpace ( 'some/path' ) ) . toBe ( '/sitename/a/b/some/path' ) ;
149144 } ) ;
150145
151146 it ( 'should use a basepath relative to the site (with trailing slash)' , ( ) => {
152- const otherSpaceBasePathLinker = linkerWithOtherSpaceBasePath ( siteGitBookIO , {
147+ const otherSpaceBasePathLinker = siteGitBookIO . withOtherSiteSpace ( {
153148 spaceBasePath : '/a/b' ,
154149 } ) ;
155150 expect ( otherSpaceBasePathLinker . toPathInSpace ( 'some/path' ) ) . toBe ( '/sitename/a/b/some/path' ) ;
0 commit comments