fix: corriger la détection d'environnement dans robots.js
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import {describe, it, expect, afterEach} from 'vitest'
|
||||
import robots from '../robots'
|
||||
|
||||
describe('robots', () => {
|
||||
const originalNodeEnv = process.env.NODE_ENV
|
||||
|
||||
afterEach(() => {
|
||||
process.env.NODE_ENV = originalNodeEnv
|
||||
})
|
||||
|
||||
it('autorise l\'indexation en production', () => {
|
||||
process.env.NODE_ENV = 'production'
|
||||
|
||||
expect(robots().rules).toEqual({userAgent: '*', allow: '/'})
|
||||
})
|
||||
|
||||
it('bloque l\'indexation hors production', () => {
|
||||
process.env.NODE_ENV = 'development'
|
||||
|
||||
expect(robots().rules).toEqual({userAgent: '*', disallow: '/'})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user