mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-26 11:10:58 +08:00
* chore: bump to msw v3 * refactor: anti-slop * test: use vi.stubEnv for REDIS_URL in redis error test * refactor: move remote debugging registration into a conditional block * chore: add code coverage upload for github
25 lines
871 B
TypeScript
25 lines
871 B
TypeScript
import { assert, describe, expect, it } from 'vitest';
|
|
|
|
import api from '@/api';
|
|
import { namespaces } from '@/registry';
|
|
|
|
describe('api/namespace/one', () => {
|
|
const nestedKey = Object.keys(namespaces).find((key) => key.includes('/'));
|
|
|
|
it('serves a single namespace over HTTP', async () => {
|
|
expect(namespaces.github).toBeDefined();
|
|
const response = await api.request('/namespace/github');
|
|
expect(response.status).toBe(200);
|
|
const data = await response.json();
|
|
expect(data).toEqual(namespaces.github);
|
|
});
|
|
|
|
it('serves a nested namespace over HTTP', async () => {
|
|
assert(nestedKey);
|
|
const response = await api.request(`/namespace/${nestedKey}`);
|
|
expect(response.status).toBe(200);
|
|
const data = await response.json();
|
|
expect(data).toEqual(namespaces[nestedKey]);
|
|
});
|
|
});
|