@@ -4,35 +4,30 @@ import { describe, expect, it } from 'vitest'
4
4
5
5
const { resolve } = createResolver ( import . meta. url )
6
6
7
- process . env . NODE_ENV = 'production'
8
- await setup ( {
9
- rootDir : resolve ( '../fixtures/basic' ) ,
10
- build : true ,
11
- nuxtConfig : {
12
- site : {
13
- env : 'staging' , // staging blocks
14
- url : 'https://example.com' ,
15
- } ,
7
+ describe ( 'query override' , async ( ) => {
8
+ process . env . NODE_ENV = 'production'
9
+ await setup ( {
10
+ rootDir : resolve ( '../fixtures/basic' ) ,
11
+ build : true ,
12
+ nuxtConfig : {
13
+ site : {
14
+ env : 'staging' , // staging blocks
15
+ url : 'https://example.com' ,
16
+ } ,
16
17
17
- robots : {
18
- debug : true ,
18
+ robots : {
19
+ debug : true ,
20
+ } ,
19
21
} ,
20
- } ,
21
- } )
22
-
23
- describe ( 'query override' , ( ) => {
22
+ } )
24
23
it ( 'robots.txt' , async ( ) => {
25
24
// blocked by default
26
25
expect ( await $fetch ( '/robots.txt' ) ) . toContain ( '(indexing disabled)' )
27
26
// but can be overridden
28
- expect ( await $fetch ( '/robots.txt' , {
29
- params : {
30
- mockProductionEnv : true ,
31
- } ,
32
- } ) ) . toContain ( '(indexable)' )
27
+ expect ( await $fetch ( '/robots.txt?mockProductionEnv=true' ) ) . toContain ( '(indexable)' )
33
28
} )
34
29
it ( 'page' , async ( ) => {
35
30
const homeResponse = await $fetch ( '/' )
36
- expect ( homeResponse . match ( / < m e t a n a m e = " r o b o t s " c o n t e n t = " ( . * ) " > / ) ?. [ 1 ] ) . toMatchInlineSnapshot ( `" noindex, nofollow"` )
31
+ expect ( homeResponse . match ( / < m e t a n a m e = " r o b o t s " c o n t e n t = " ( [ ^ " ] * ) " > / ) ?. [ 1 ] ) . toBe ( ' noindex, nofollow' )
37
32
} )
38
33
} )
0 commit comments