Download lib/api/namespace.test.ts from ASEM12345/rsshub: direct link, hf CLI and curl.
- Browser
- Download file 735 Bytes
-
https://huggingface.co/spaces/ASEM12345/rsshub/resolve/main/lib/api/namespace.test.ts
- Command line
-
hf download hf://spaces/ASEM12345/rsshub/lib/api/namespace.test.ts
-
curl -L -o namespace.test.ts https://huggingface.co/spaces/ASEM12345/rsshub/resolve/main/lib/api/namespace.test.ts
735 Bytes
| import { describe, expect, it } from 'vitest'; | |
| import { handler as allHandler } from '@/api/namespace/all'; | |
| import { handler as oneHandler } from '@/api/namespace/one'; | |
| import { namespaces } from '@/registry'; | |
| const createCtx = (param: Record<string, string> = {}) => | |
| ({ | |
| req: { | |
| valid: () => param, | |
| }, | |
| json: (data: unknown) => data, | |
| }) as any; | |
| describe('api/namespace', () => { | |
| it('returns all namespaces', () => { | |
| const result = allHandler(createCtx()); | |
| expect(result).toBe(namespaces); | |
| }); | |
| it('returns a single namespace', () => { | |
| const result = oneHandler(createCtx({ namespace: 'test' })); | |
| expect(result).toBe(namespaces.test); | |
| }); | |
| }); | |