mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('sitemap-group', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('should not add suffix to sitemap under group routes', async () => {
|
|
const res = await next.fetch('/foo/sitemap.xml')
|
|
expect(res.status).toBe(200)
|
|
expect(res.headers.get('content-type')).toBe('application/xml')
|
|
const text = await res.text()
|
|
expect(text).toMatchInlineSnapshot(`
|
|
"<?xml version="1.0" encoding="UTF-8"?>
|
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
<url>
|
|
<loc>https://www.vercel.com</loc>
|
|
<lastmod>2024-12-05T23:45:13.405Z</lastmod>
|
|
<changefreq>monthly</changefreq>
|
|
</url>
|
|
</urlset>
|
|
"
|
|
`)
|
|
})
|
|
|
|
it('should not add suffix to static sitemap.xml under group routes', async () => {
|
|
const res = await next.fetch('/bar/sitemap.xml')
|
|
expect(res.status).toBe(200)
|
|
expect(res.headers.get('content-type')).toBe('application/xml')
|
|
const text = await res.text()
|
|
expect(text).toMatchInlineSnapshot(`
|
|
"<?xml version="1.0" encoding="UTF-8"?>
|
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
<url>
|
|
<loc>https://vercel.com/</loc>
|
|
<lastmod>2023-03-06T18:04:14.008Z</lastmod>
|
|
</url>
|
|
</urlset>
|
|
"
|
|
`)
|
|
})
|
|
})
|