Files
RSSHub/lib/registry.test.ts
T
DIYgod b774c60858 test: add full routes test (#14934)
* test: add critical routes test

* fix: youtube channels config

* test: add full routes test

* test: output full routes test result

* test: build routes before test

* test: use one reporter

* test: fix cache test errors

* test: fix cache test errors

* chore: puppeteerrc.cjs

* chore: puppeteerrc.cjs

* chore: puppeteerrc.cjs

* fix: build script

* chore: puppeteerrc rename

* test: route test names

* chore: pass test result to docs
2024-03-24 19:00:03 +08:00

33 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import app from '@/app';
import { config } from '@/config';
describe('registry', () => {
// root
it(`/`, async () => {
const response = await app.request('/');
expect(response.status).toBe(200);
expect(response.headers.get('content-type')).toBe('text/html; charset=UTF-8');
expect(response.headers.get('cache-control')).toBe('no-cache');
});
// robots.txt
it('/robots.txt', async () => {
config.disallowRobot = false;
const response404 = await app.request('/robots.txt');
expect(response404.status).toBe(404);
config.disallowRobot = true;
const response = await app.request('/robots.txt');
expect(response.status).toBe(200);
expect(await response.text()).toBe('User-agent: *\nDisallow: /');
expect(response.headers.get('content-type')).toBe('text/plain; charset=UTF-8');
});
// favicon.ico
it('/favicon.ico', async () => {
const response = await app.request('/favicon.ico');
expect(response.status).toBe(200);
});
});