mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-03 18:48:12 +08:00
test: request-wrapper
This commit is contained in:
16
test/utils/rss-parser.js
Normal file
16
test/utils/rss-parser.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const parser = require('../../lib/utils/rss-parser');
|
||||
const config = require('../../lib/config');
|
||||
const nock = require('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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user