Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2024 09 #547

Merged
merged 5 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ See live site [here](https://cleasby-vigfusson-dictionary.vercel.app/)
Related projects:
- [Cleasby & Vigfusson Dictionary](https://github.com/stscoundrel/cleasby-vigfusson-dictionary).
- [Cleasby & Vigfusson Abbreviations](https://github.com/stscoundrel/cleasby-vigfusson-abbreviations).
- [Cleasby & Vigfusson Gatsby Source Plugin](https://github.com/stscoundrel/gatsby-source-cleasby-vigfusson)

## Features

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"cleasby-vigfusson-abbreviations": "^1.0.11",
"cleasby-vigfusson-dictionary": "^1.0.16",
"markari": "^1.0.7",
"next": "14.2.3",
"next": "^14.2.3",
"next-pwa": "^5.6.0",
"old-norse-alphabet": "^1.2.4",
"react": "18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion public/sitemap.xml

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions tests/unit/lib/services/sitemap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { SitemapStream, streamToPromise } from 'sitemap'
import { hasProperty } from 'spyrjari'
import { isArray } from 'volva'
import { getSitemapContent, formatSitemap } from 'lib/services/sitemap'
import { readFileSync } from 'node:fs'

describe('Sitemap tests', () => {
process.env.NEXT_PUBLIC_SITE_URL = 'https://cleasbyvigfusson.test'
process.env.NEXT_PUBLIC_SITE_URL = 'https://cleasby-vigfusson-dictionary.vercel.app'
const content = getSitemapContent()

test('Sitemap content is an array', () => {
Expand All @@ -23,6 +24,15 @@ describe('Sitemap tests', () => {
const result = await formatSitemap(content, SitemapStream, streamToPromise)

expect(result.includes('<?xml version="1.0" encoding="UTF-8"?>')).toBeTruthy()
expect(result.includes('<url><loc>https://cleasbyvigfusson.test/word/al-blindr</loc><changefreq>monthly</changefreq><priority>0.5</priority></url>')).toBeTruthy()
expect(result.includes('<url><loc>https://cleasby-vigfusson-dictionary.vercel.app/word/al-blindr</loc><changefreq>monthly</changefreq><priority>0.5</priority></url>')).toBeTruthy()
})

test('Generated sitemap in public is up to date.', async () => {
// Whenever underlying data changes, the sitemap should change too.
// Guard this with comparison to freshly generated version.
const publicSitemap = readFileSync(`${__dirname}/../../../../public/sitemap.xml`).toString()
const result = await formatSitemap(content, SitemapStream, streamToPromise)

expect(publicSitemap).toEqual(result)
})
})
Loading
Loading