66 */
77
88import path from 'path' ;
9- import { mergeWithCustomize } from 'webpack-merge' ;
109import { loadSetup } from './testUtils' ;
11- import type { Props } from '@docusaurus/types' ;
12- import type { DeepPartial } from 'utility-types' ;
1310
1411describe ( 'load' , ( ) => {
15- it ( 'loads props for site with custom i18n path ' , async ( ) => {
12+ it ( 'loads props for site' , async ( ) => {
1613 const site = await loadSetup ( 'custom-i18n-site' ) ;
1714 expect ( site . props ) . toMatchSnapshot ( ) ;
18- const site2 = await loadSetup ( 'custom-i18n-site' , { locale : 'zh-Hans' } ) ;
19- expect ( site2 . props ) . toEqual (
20- mergeWithCustomize < DeepPartial < Props > > ( {
21- customizeArray ( a , b , key ) {
22- return [ 'routesPaths' , 'plugins' ] . includes ( key ) ? b : undefined ;
23- } ,
24- } ) ( site . props , {
15+ } ) ;
16+
17+ it ( 'loads props for site - custom i18n path' , async ( ) => {
18+ const site = await loadSetup ( 'custom-i18n-site' , { locale : 'zh-Hans' } ) ;
19+ expect ( site . props ) . toEqual (
20+ expect . objectContaining ( {
2521 baseUrl : '/zh-Hans/' ,
26- i18n : {
22+ i18n : expect . objectContaining ( {
2723 currentLocale : 'zh-Hans' ,
28- } ,
24+ } ) ,
2925 localizationDir : path . join (
3026 __dirname ,
3127 '__fixtures__/custom-i18n-site/i18n/zh-Hans-custom' ,
@@ -35,14 +31,14 @@ describe('load', () => {
3531 '__fixtures__/custom-i18n-site/build/zh-Hans' ,
3632 ) ,
3733 routesPaths : [ '/zh-Hans/404.html' ] ,
38- siteConfig : {
34+ siteConfig : expect . objectContaining ( {
3935 baseUrl : '/zh-Hans/' ,
40- } ,
36+ } ) ,
4137 siteStorage : {
4238 namespace : '' ,
4339 type : 'localStorage' ,
4440 } ,
45- plugins : site2 . props . plugins ,
41+ plugins : site . props . plugins ,
4642 } ) ,
4743 ) ;
4844 } ) ;
0 commit comments