Skip to content

Commit

Permalink
chore: test for inferStaticPagesAsRoutes
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Sep 12, 2023
1 parent 9877afc commit 93dc0ae
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/integration/single/inferStaticPagesAsRoutes.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { describe, expect, it } from 'vitest'
import { createResolver } from '@nuxt/kit'
import { $fetch, setup } from '@nuxt/test-utils'

const { resolve } = createResolver(import.meta.url)

await setup({
rootDir: resolve('../../fixtures/basic'),
nuxtConfig: {
sitemap: {
inferStaticPagesAsRoutes: false,
dynamicUrlsApiEndpoint: '/__sitemap',
},
},
})
describe('inferStaticPagesAsRoutes', () => {
it('disabled', async () => {
const posts = await $fetch('/sitemap.xml')

expect(posts).toMatchInlineSnapshot(`
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><?xml-stylesheet type=\\"text/xsl\\" href=\\"/__sitemap__/style.xsl\\"?>
<urlset xmlns:xsi=\\"http://www.w3.org/2001/XMLSchema-instance\\" xmlns:video=\\"http://www.google.com/schemas/sitemap-video/1.1\\" xmlns:xhtml=\\"http://www.w3.org/1999/xhtml\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\" xsi:schemaLocation=\\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd\\" xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\">
<url>
<loc>https://nuxtseo.com/__sitemap/abs</loc>
</url>
<url>
<loc>https://nuxtseo.com/__sitemap/loc</loc>
</url>
<url>
<loc>https://nuxtseo.com/__sitemap/url</loc>
</url>
</urlset>"
`)
}, 60000)
})

0 comments on commit 93dc0ae

Please sign in to comment.