-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsitemap.test.ts
More file actions
24 lines (21 loc) · 813 Bytes
/
Copy pathsitemap.test.ts
File metadata and controls
24 lines (21 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// @vitest-environment node
import { describe, expect, it } from 'vitest';
import { getSortedFeedData } from '@/blog/services/post-repository';
import { SITE_URL } from '@/site/config/site';
import sitemap from './sitemap';
describe('sitemap', () => {
it('excludes private posts from sitemap entries', () => {
const entries = sitemap();
const urls = entries.map((entry) => entry.url);
const privatePosts = getSortedFeedData({ includePrivate: true }).filter(
(post) => post.visibility === 'private'
);
expect(urls).toContain(`${SITE_URL}/blog/ctr-pipeline`);
expect(privatePosts.length).toBeGreaterThan(0);
for (const post of privatePosts) {
expect(urls, `${post.slug} leaked to sitemap`).not.toContain(
`${SITE_URL}/blog/${post.slug}`
);
}
});
});