test: rss-parser

This commit is contained in:
DIYgod
2024-02-25 00:33:10 +08:00
parent 031af3f755
commit 33861197f0
+17
View File
@@ -0,0 +1,17 @@
import { describe, expect, it } from '@jest/globals';
import parser from '@/utils/rss-parser';
import { config } from '@/config';
import nock from 'nock';
describe('got', () => {
it('headers', async () => {
nock('http://rsshub.test')
.get('/test')
.reply(function () {
expect(this.req.headers['user-agent']).toBe(config.ua);
return [200, '<rss version="2.0"><channel><item></item></channel></rss>'];
});
await parser.parseURL('http://rsshub.test/test');
});
});