mirror of
https://github.com/privacy-scaling-explorations/pse.dev.git
synced 2026-01-09 14:18:02 -05:00
* remove algoliasearch and update search with weight (title=100, tags=50, tldr=25, content=10) * fix project search and update search with regex \bword\b or \bword * remove algolia dependencies from package.json, yarn.lock, etc. * Base search on fuse.js, implement same search in projects/ blog/ and navbar search * add research to navbar search, improve search functionality, update test.
64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
import { describe, it, expect } from "vitest"
|
|
|
|
/**
|
|
* API Test Suite Overview
|
|
*
|
|
* This test ensures that all API endpoints have comprehensive test coverage
|
|
* to prevent regressions and maintain API reliability.
|
|
*/
|
|
|
|
describe("API Test Coverage", () => {
|
|
const apiEndpoints = [
|
|
"/api/articles",
|
|
"/api/projects",
|
|
"/api/search",
|
|
"/api/search/indexes",
|
|
"/api/youtube",
|
|
"/api/youtube/videos",
|
|
"/api/rss",
|
|
]
|
|
|
|
const testFiles = [
|
|
"tests/api/articles.test.ts",
|
|
"tests/api/projects.test.ts",
|
|
"tests/api/search.test.ts",
|
|
"tests/api/search-indexes.test.ts",
|
|
"tests/api/youtube.test.ts",
|
|
"tests/api/youtube-videos.test.ts",
|
|
"tests/api/rss.test.ts",
|
|
]
|
|
|
|
it("has test coverage for all API endpoints", () => {
|
|
expect(apiEndpoints.length).toBe(testFiles.length)
|
|
expect(apiEndpoints.length).toBeGreaterThan(0)
|
|
})
|
|
|
|
it("covers all critical API functionality", () => {
|
|
const expectedTestCategories = [
|
|
"Content APIs (articles, projects)",
|
|
"Search functionality (local)",
|
|
"External integrations (Discord, YouTube)",
|
|
"RSS feed generation",
|
|
"Error handling and validation",
|
|
"CORS support",
|
|
"Environment variable validation",
|
|
]
|
|
|
|
expect(expectedTestCategories.length).toBeGreaterThan(0)
|
|
})
|
|
|
|
it("includes regression prevention tests", () => {
|
|
const regressionTestAreas = [
|
|
"Parameter validation",
|
|
"Error response consistency",
|
|
"Authentication and authorization",
|
|
"Rate limiting considerations",
|
|
"Data transformation accuracy",
|
|
"External API error handling",
|
|
"Environment configuration",
|
|
]
|
|
|
|
expect(regressionTestAreas.length).toBeGreaterThan(0)
|
|
})
|
|
})
|