2026-08-03 15:50:24 +08:00
|
|
|
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', () => {
|
2026-08-04 14:15:32 +08:00
|
|
|
it('allows qualification uploads with multipart overhead through the API proxy', () => {
|
|
|
|
|
expect(config).toContain('client_max_body_size 6m;')
|
|
|
|
|
})
|
|
|
|
|
|
2026-08-03 15:50:24 +08:00
|
|
|
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"')
|
|
|
|
|
})
|
|
|
|
|
})
|