Skip to content

Commit

Permalink
test: add test for skipping 404-ed localized URLs in createUrlSet
Browse files Browse the repository at this point in the history
  • Loading branch information
sreetamdas committed Apr 28, 2022
1 parent d482eaf commit 6af06da
Showing 1 changed file with 76 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { createUrlSet } from '..'
import { transformSitemap } from '../../../config'
import { sampleConfig } from '../../../fixtures/config'
import { sampleManifest, sampleI18nManifest } from '../../../fixtures/manifest'
import {
sampleManifest,
sampleI18nManifest,
sampleNotFoundRoutesManifest,
} from '../../../fixtures/manifest'
import { IConfig, ISitemapField } from '../../../interface'

describe('createUrlSet', () => {
Expand Down Expand Up @@ -582,4 +586,75 @@ describe('createUrlSet', () => {
}),
])
})

test('with i18n, without notFound routes', async () => {
const urlset = await createUrlSet(
{
...sampleConfig,
},
sampleNotFoundRoutesManifest
)

expect(urlset).toStrictEqual([
{
changefreq: 'daily',
lastmod: expect.any(String),
priority: 0.7,
loc: 'https://example.com',
alternateRefs: [],
trailingSlash: false,
},
{
changefreq: 'daily',
lastmod: expect.any(String),
priority: 0.7,
loc: 'https://example.com/about',
alternateRefs: [],
trailingSlash: false,
},
// /about
{
changefreq: 'daily',
lastmod: expect.any(String),
priority: 0.7,
loc: 'https://example.com/nl-NL',
alternateRefs: [],
trailingSlash: false,
},
{
changefreq: 'daily',
lastmod: expect.any(String),
priority: 0.7,
loc: 'https://example.com/fr/about',
alternateRefs: [],
trailingSlash: false,
},
// page-0
{
changefreq: 'daily',
lastmod: expect.any(String),
priority: 0.7,
loc: 'https://example.com/page-0',
alternateRefs: [],
trailingSlash: false,
},
{
changefreq: 'daily',
lastmod: expect.any(String),
priority: 0.7,
loc: 'https://example.com/fr/page-0',
alternateRefs: [],
trailingSlash: false,
},
// page-1
{
changefreq: 'daily',
lastmod: expect.any(String),
priority: 0.7,
loc: 'https://example.com/page-1',
alternateRefs: [],
trailingSlash: false,
},
])
})
})

0 comments on commit 6af06da

Please sign in to comment.