24 lines
996 B
TypeScript
24 lines
996 B
TypeScript
import { readFileSync } from 'node:fs'
|
|||
|
|
import { resolve } from 'node:path'
|
||
|
|
import { describe, expect, it } from 'vitest'
|
||
|
|
|
||
|
|
const config = readFileSync(resolve(process.cwd(), 'nginx/default.conf.template'), 'utf8')
|
||
|
|
|
||
|
|
describe('admin nginx deployment config', () => {
|
||
|
|
it('prevents the application shell from retaining stale chunk references', () => {
|
||
|
|
expect(config).toContain('location = /index.html')
|
||
|
|
expect(config).toContain('Cache-Control "no-cache, no-store, must-revalidate"')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('serves hashed assets immutably and never falls back missing chunks to HTML', () => {
|
||
|
|
expect(config).toContain('location /assets/')
|
||
|
|
expect(config).toContain('try_files $uri =404;')
|
||
|
|
expect(config).toContain('Cache-Control "public, max-age=31536000, immutable"')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('keeps Vue history routes on the application shell without caching them', () => {
|
||
|
|
expect(config).toContain('try_files $uri $uri/ /index.html;')
|
||
|
|
expect(config).toContain('Cache-Control "no-cache"')
|
||
|
|
})
|
||
|
|
})
|