@@ -2,31 +2,16 @@ const Unibit = require('../src/unibit');
22const unibit = new Unibit ( ) ;
33
44const aboutPage = {
5- "absPath" : "/Users/rodik/Work/Stackbit/project-repos/unibit/sample/unibit-universal/content/about.md" ,
65 "relPath" : "about.md" ,
7- "absDir" : "/Users/rodik/Work/Stackbit/project-repos/unibit/sample/unibit-universal/content" ,
8- "relDir" : "" ,
96 "url" : "about/" ,
10- "basename" : "about.md" ,
11- "filename" : "about"
127}
138const feature1Page = {
14- "absPath" : "/Users/rodik/Work/Stackbit/project-repos/unibit/sample/unibit-universal/content/features/feature1.md" ,
159 "relPath" : "features/feature1.md" ,
16- "absDir" : "/Users/rodik/Work/Stackbit/project-repos/unibit/sample/unibit-universal/content/features" ,
17- "relDir" : "features" ,
1810 "url" : "features/feature1/" ,
19- "basename" : "feature1.md" ,
20- "filename" : "feature1"
2111} ;
2212const feature2Page = {
23- "absPath" : "/Users/rodik/Work/Stackbit/project-repos/unibit/sample/unibit-universal/content/features/feature2.md" ,
2413 "relPath" : "features/feature2.md" ,
25- "absDir" : "/Users/rodik/Work/Stackbit/project-repos/unibit/sample/unibit-universal/content/features" ,
26- "relDir" : "features" ,
2714 "url" : "features/feature2/" ,
28- "basename" : "feature2.md" ,
29- "filename" : "feature2"
3015} ;
3116
3217const linksSSGData = [
@@ -62,6 +47,16 @@ describe('getPage', ()=>{
6247 it ( 'gets a page by url' , ( ) => {
6348 let page = unibit . getPage ( pageContext , 'about' ) ;
6449 expect ( page ) . toBe ( aboutPage ) ;
50+
51+ page = unibit . getPage ( pageContext , '/about' ) ;
52+ expect ( page ) . toBe ( aboutPage ) ;
53+
54+ page = unibit . getPage ( pageContext , '/about/' ) ;
55+ expect ( page ) . toBe ( aboutPage ) ;
56+
57+ page = unibit . getPage ( pageContext , 'about/' ) ;
58+ expect ( page ) . toBe ( aboutPage ) ;
59+
6560 } ) ;
6661 it ( 'should not work with file paths' , ( ) => {
6762 let page = unibit . getPage ( pageContext , 'about.md' ) ;
@@ -101,8 +96,8 @@ describe('getPageByFilePath', ()=>{
10196 expect ( data ) . toBe ( feature1Page ) ;
10297 } ) ;
10398
104- it ( 'gets a page by url ' , ( ) => {
99+ it ( 'should not work with urls ' , ( ) => {
105100 let data = unibit . getPageByFilePath ( pageContext , 'features/feature1' ) ;
106- expect ( data ) . toBe ( feature1Page ) ;
101+ expect ( data ) . toBeUndefined ( ) ;
107102 } ) ;
108103} )
0 commit comments