@@ -5,6 +5,14 @@ import { createBaseApp, createPage } from '../../src/index.js'
55
66describe ( 'should work without plugins' , ( ) => {
77 const app = createBaseApp ( {
8+ locales : {
9+ '/' : {
10+ lang : 'en-US' ,
11+ } ,
12+ '/zh/' : {
13+ lang : 'zh-CN' ,
14+ } ,
15+ } ,
816 source : path . resolve ( __dirname , 'fake-source' ) ,
917 theme : { name : 'test' } ,
1018 bundler : { } as Bundler ,
@@ -86,6 +94,37 @@ describe('should work without plugins', () => {
8694 )
8795 expect ( page . chunkName ) . toBeTruthy ( )
8896 } )
97+
98+ it ( 'should create a zh page' , async ( ) => {
99+ const page = await createPage ( app , {
100+ path : '/zh/test.html' ,
101+ } )
102+
103+ // page data
104+ expect ( page . data . path ) . toBe ( '/zh/test.html' )
105+ expect ( page . data . lang ) . toBe ( 'zh-CN' )
106+
107+ // base fields
108+ expect ( page . path ) . toBe ( '/zh/test.html' )
109+ expect ( page . lang ) . toBe ( 'zh-CN' )
110+
111+ // file info
112+ expect ( page . htmlFilePath ) . toBe ( app . dir . dest ( `zh/test.html` ) )
113+ expect ( page . htmlFilePathRelative ) . toBe ( `zh/test.html` )
114+ expect ( page . componentFilePath ) . toBe (
115+ app . dir . temp ( `pages/${ page . htmlFilePathRelative } .vue` ) ,
116+ )
117+ expect ( page . componentFilePathRelative ) . toBe (
118+ `pages/${ page . htmlFilePathRelative } .vue` ,
119+ )
120+ expect ( page . chunkFilePath ) . toBe (
121+ app . dir . temp ( `pages/${ page . htmlFilePathRelative } .js` ) ,
122+ )
123+ expect ( page . chunkFilePathRelative ) . toBe (
124+ `pages/${ page . htmlFilePathRelative } .js` ,
125+ )
126+ expect ( page . chunkName ) . toBeTruthy ( )
127+ } )
89128} )
90129
91130describe ( 'should work with plugins' , ( ) => {
0 commit comments