5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
7
8
- import { createElement } from 'react' ;
9
8
import { fromPartial } from '@total-typescript/shoehorn' ;
10
9
import createSitemap from '../createSitemap' ;
11
10
import type { PluginOptions } from '../options' ;
@@ -39,7 +38,7 @@ describe('createSitemap', () => {
39
38
const sitemap = await createSitemap ( {
40
39
siteConfig,
41
40
routes : routes ( [ '/' , '/test' ] ) ,
42
- head : { } ,
41
+ routesBuildMetadata : { } ,
43
42
options,
44
43
} ) ;
45
44
expect ( sitemap ) . toContain (
@@ -51,7 +50,7 @@ describe('createSitemap', () => {
51
50
const sitemap = await createSitemap ( {
52
51
siteConfig,
53
52
routes : routes ( [ ] ) ,
54
- head : { } ,
53
+ routesBuildMetadata : { } ,
55
54
options,
56
55
} ) ;
57
56
expect ( sitemap ) . toBeNull ( ) ;
@@ -67,7 +66,7 @@ describe('createSitemap', () => {
67
66
'/search/foo' ,
68
67
'/tags/foo/bar' ,
69
68
] ) ,
70
- head : { } ,
69
+ routesBuildMetadata : { } ,
71
70
options : {
72
71
...options ,
73
72
ignorePatterns : [
@@ -94,7 +93,7 @@ describe('createSitemap', () => {
94
93
'/search/foo' ,
95
94
'/tags/foo/bar' ,
96
95
] ) ,
97
- head : { } ,
96
+ routesBuildMetadata : { } ,
98
97
options : {
99
98
...options ,
100
99
createSitemapItems : async ( params ) => {
@@ -119,7 +118,7 @@ describe('createSitemap', () => {
119
118
const sitemap = await createSitemap ( {
120
119
siteConfig,
121
120
routes : routes ( [ '/' , '/docs/myDoc/' , '/blog/post' ] ) ,
122
- head : { } ,
121
+ routesBuildMetadata : { } ,
123
122
options : {
124
123
...options ,
125
124
createSitemapItems : async ( ) => {
@@ -135,7 +134,7 @@ describe('createSitemap', () => {
135
134
const sitemap = await createSitemap ( {
136
135
siteConfig,
137
136
routes : routes ( [ '/' , '/test' , '/nested/test' , '/nested/test2/' ] ) ,
138
- head : { } ,
137
+ routesBuildMetadata : { } ,
139
138
options,
140
139
} ) ;
141
140
@@ -149,7 +148,7 @@ describe('createSitemap', () => {
149
148
const sitemap = await createSitemap ( {
150
149
siteConfig : { ...siteConfig , trailingSlash : true } ,
151
150
routes : routes ( [ '/' , '/test' , '/nested/test' , '/nested/test2/' ] ) ,
152
- head : { } ,
151
+ routesBuildMetadata : { } ,
153
152
options,
154
153
} ) ;
155
154
@@ -167,7 +166,7 @@ describe('createSitemap', () => {
167
166
trailingSlash : false ,
168
167
} ,
169
168
routes : routes ( [ '/' , '/test' , '/nested/test' , '/nested/test2/' ] ) ,
170
- head : { } ,
169
+ routesBuildMetadata : { } ,
171
170
options,
172
171
} ) ;
173
172
@@ -180,19 +179,10 @@ describe('createSitemap', () => {
180
179
it ( 'filters pages with noindex' , async ( ) => {
181
180
const sitemap = await createSitemap ( {
182
181
siteConfig,
183
- routesPaths : [ '/' , '/noindex' , '/nested/test' , '/nested/test2/' ] ,
184
182
routes : routes ( [ '/' , '/noindex' , '/nested/test' , '/nested/test2/' ] ) ,
185
- head : {
183
+ routesBuildMetadata : {
186
184
'/noindex' : {
187
- meta : {
188
- // @ts -expect-error: bad lib def
189
- toComponent : ( ) => [
190
- createElement ( 'meta' , {
191
- name : 'robots' ,
192
- content : 'NoFolloW, NoiNDeX' ,
193
- } ) ,
194
- ] ,
195
- } ,
185
+ noIndex : true ,
196
186
} ,
197
187
} ,
198
188
options,
@@ -204,24 +194,13 @@ describe('createSitemap', () => {
204
194
it ( 'does not generate anything for all pages with noindex' , async ( ) => {
205
195
const sitemap = await createSitemap ( {
206
196
siteConfig,
207
- routesPaths : [ '/' , '/noindex' ] ,
208
197
routes : routes ( [ '/' , '/noindex' ] ) ,
209
- head : {
198
+ routesBuildMetadata : {
210
199
'/' : {
211
- meta : {
212
- // @ts -expect-error: bad lib def
213
- toComponent : ( ) => [
214
- createElement ( 'meta' , { name : 'robots' , content : 'noindex' } ) ,
215
- ] ,
216
- } ,
200
+ noIndex : true ,
217
201
} ,
218
202
'/noindex' : {
219
- meta : {
220
- // @ts -expect-error: bad lib def
221
- toComponent : ( ) => [
222
- createElement ( 'meta' , { name : 'robots' , content : 'noindex' } ) ,
223
- ] ,
224
- } ,
203
+ noIndex : true ,
225
204
} ,
226
205
} ,
227
206
options,
0 commit comments