Download lib/app.test.ts from ASEM12345/rsshub: direct link, hf CLI and curl.
- Browser
- Download file 719 Bytes
-
https://huggingface.co/spaces/ASEM12345/rsshub/resolve/main/lib/app.test.ts
- Command line
-
hf download hf://spaces/ASEM12345/rsshub/lib/app.test.ts
-
curl -L -o app.test.ts https://huggingface.co/spaces/ASEM12345/rsshub/resolve/main/lib/app.test.ts
719 Bytes
| import undici from 'undici'; | |
| import { describe, expect, it, vi } from 'vitest'; | |
| import app from '@/app'; | |
| const { config } = await import('@/config'); | |
| describe('index', () => { | |
| it('serve index', async () => { | |
| const res = await app.request('/'); | |
| expect(res.status).toBe(200); | |
| expect(await res.text()).toContain('Welcome to RSSHub!'); | |
| }); | |
| }); | |
| describe('request-rewriter', () => { | |
| it('should rewrite request', async () => { | |
| const fetchSpy = vi.spyOn(undici, 'fetch'); | |
| await app.request('/test/httperror'); | |
| // headers | |
| const headers: Headers = fetchSpy.mock.lastCall?.[0].headers; | |
| expect(headers.get('user-agent')).toBe(config.ua); | |
| }); | |
| }); | |