Add status route tests, OG images blog post, and blog tests
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 9m27s
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 9m27s
- Create src/routes/__tests__/status.test.ts (GET /status and /status.html) - Add blog post: public/blog/automating-og-images.html (~1000 words) - Update public/blog.html with new post entry - Update public/sitemap.xml with new URL - Add blog tests for automating-og-images post - Update existing blog tests for new post references Tests: 332 passed, 1 skipped
This commit is contained in:
parent
05c91e6747
commit
740c70f905
5 changed files with 378 additions and 1 deletions
36
src/routes/__tests__/status.test.ts
Normal file
36
src/routes/__tests__/status.test.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import { describe, it, expect } from 'vitest'
|
||||
import request from 'supertest'
|
||||
import express from 'express'
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const publicDir = path.join(__dirname, '../../../public')
|
||||
|
||||
function createApp() {
|
||||
const app = express()
|
||||
app.use(express.static(publicDir, { etag: true }))
|
||||
|
||||
// Mirror the status route from index.ts
|
||||
app.get('/status', (_req, res) => {
|
||||
res.sendFile(path.join(publicDir, 'status.html'))
|
||||
})
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
describe('Status Route', () => {
|
||||
const app = createApp()
|
||||
|
||||
it('GET /status returns 200', async () => {
|
||||
const res = await request(app).get('/status')
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers['content-type']).toContain('text/html')
|
||||
})
|
||||
|
||||
it('GET /status.html returns 200', async () => {
|
||||
const res = await request(app).get('/status.html')
|
||||
expect(res.status).toBe(200)
|
||||
expect(res.headers['content-type']).toContain('text/html')
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue