diff --git a/.gitignore b/.gitignore index fab3561..866a7b8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ node_modules !.env.example .vercel .output +.netlify /static/public /static/all.css diff --git a/src/routes/(public)/well-known.spec.ts b/src/routes/(public)/well-known.spec.ts new file mode 100644 index 0000000..1e726c9 --- /dev/null +++ b/src/routes/(public)/well-known.spec.ts @@ -0,0 +1,29 @@ +import { test, expect } from '@playwright/test' + +test.describe('.well-known/security.txt', () => { + test.beforeEach(async ({ page }) => { + await page.goto('/.well-known/security.txt', { waitUntil: 'domcontentloaded' }) + }) + + test('contains contact information', async ({ page }) => { + let content = await page.locator('pre').first().textContent() + expect(/mailto:(.+@.+\.[a-z]{2,3})/i.test(content!)).toBeTruthy() + }) + + test('contains valid expiration date', async ({ page }) => { + let content = await page.locator('pre').first().textContent() + expect.soft(content).toContain('Expires: ') + let date_match = content?.match(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/i) + expect.soft(date_match).toBeTruthy() + let parsed_date = new Date(date_match![0]) + expect.soft(parsed_date.getTime()).toBeGreaterThanOrEqual(Date.now()) + }) +}) + +test.describe('.well-known/atproto-did', () => { + test('it exists', async ({ page }) => { + await page.goto('/.well-known/atproto-did', { waitUntil: 'domcontentloaded' }) + let content = await page.locator('pre').first().textContent() + expect(/did:plc:[a-z0-9]{24}/.test(content!)).toBeTruthy() + }) +}) diff --git a/src/routes/seo.spec.ts b/src/routes/seo.spec.ts index 1ee8b83..821cff1 100644 --- a/src/routes/seo.spec.ts +++ b/src/routes/seo.spec.ts @@ -18,3 +18,14 @@ test('outdated docs/blog', async ({ page }) => { await page.goto('/blog/delete-account', { waitUntil: 'domcontentloaded' }) await expect(page).toHaveURL(/\/blog$/) }) + +test.describe('robots.txt', () => { + test.beforeEach(async ({ page }) => { + await page.goto('/robots.txt', { waitUntil: 'domcontentloaded' }) + }) + + test('should have link to sitemap', async ({ page }) => { + let content = await page.locator('pre').first().textContent() + expect(content).toContain('Sitemap: https://www.projectwallace.com/sitemap.txt') + }) +}) \ No newline at end of file