Skip to content
This repository was archived by the owner on Feb 25, 2022. It is now read-only.

Commit f8b2c11

Browse files
authored
Merge pull request #51 from adobe/fix-feed-tests
feat(feeds): support more RSS feed URL patterns
2 parents 3a28df4 + 7ec1a7a commit f8b2c11

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

src/matchers/feed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const parser = new Parser();
1616
module.exports = {
1717
required: [],
1818
pattern: (url) => {
19-
if (/[&?]feed=atom/.test(url)) {
19+
if (/\/feeds\/|[&?]feed=atom/.test(url)) {
2020
return true;
2121
}
2222
return false;

test/feed.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ const { main } = require('../src/index');
1616
describe('Feed Tests', () => {
1717
it('Works for RSS Feeds', async () => {
1818
const result = await main({
19-
__ow_path: '/https://blogs.adobe.com/psirt/',
20-
__ow_query: 'feed=atom',
19+
__ow_path: '/https://daringfireball.net/feeds/articles',
20+
__ow_query: '',
2121
});
2222
assert.equal(result.statusCode, 200);
23-
assert.equal(result.body.length, 10);
23+
assert.ok(result.body.length > 1);
2424
}).timeout(10000);
2525

2626
it('Works for RSS Feeds with Limits', async () => {
2727
const result = await main({
28-
__ow_path: '/https://blogs.adobe.com/psirt/',
29-
__ow_query: 'feed=atom&hlx_p.limit=1',
28+
__ow_path: '/https://daringfireball.net/feeds/main',
29+
__ow_query: 'hlx_p.limit=1',
3030
});
3131
assert.equal(result.statusCode, 200);
3232
assert.equal(result.body.length, 1);

test/post-deploy.test.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,28 @@ describe('Post-Deploy Tests', () => {
3535
it('RSS Embed', async () => {
3636
await chai
3737
.request('https://adobeioruntime.net/')
38-
.get(`${getbaseurl()}/https://blogs.adobe.com/psirt/?feed=atom`)
38+
.get(`${getbaseurl()}/https://daringfireball.net/feeds/main`)
3939
.then((response) => {
4040
expect(response).to.be.json;
41-
expect(response.body).to.be.an('array').that.has.length(10);
41+
expect(response.body).to.be.an('array');
4242
expect(response).to.have.status(200);
4343
}).catch((e) => {
4444
throw e;
4545
});
4646
}).timeout(10000);
4747

4848
it('Excel Embed', async () => {
49-
console.log('Trying', `https://adobeioruntime.net/${getbaseurl()}/https://adobe.sharepoint.com/sites/TheBlog/_layouts/15/guestaccess.aspx?share=ESR1N29Z7HpCh1Zfs_0YS_gB4gVSuKyWRut-kNcHVSvkew&email=helix%40adobe.com&e=hx0OUl`);
49+
console.log('Trying', 'https://adobe-my.sharepoint.com/personal/trieloff_adobe_com/_layouts/15/guestaccess.aspx?share=Edoi88tLKLpDsKzSfL-pcJYB2lIo7UKooYWnjm3w2WRrsA&email=helix%40adobe.com&e=tD623x');
5050

5151
await chai
5252
.request('https://adobeioruntime.net/')
53-
.get(`${getbaseurl()}/https://adobe.sharepoint.com/sites/TheBlog/_layouts/15/guestaccess.aspx?share=ESR1N29Z7HpCh1Zfs_0YS_gB4gVSuKyWRut-kNcHVSvkew&email=helix%40adobe.com&e=hx0OUl`)
53+
.get(`${getbaseurl()}/https://adobe-my.sharepoint.com/personal/trieloff_adobe_com/_layouts/15/guestaccess.aspx?share=Edoi88tLKLpDsKzSfL-pcJYB2lIo7UKooYWnjm3w2WRrsA&email=helix%40adobe.com&e=tD623x`)
5454
.then((response) => {
5555
// console.log(response.body);
5656
expect(response).to.be.json;
5757
expect(response.body).to.be.an('array').that.deep.includes({
58-
'import date': '2020-04-23T12:55:40.852Z',
59-
url: 'https://theblog.adobe.com/best-practices-in-content-management-it-edition/',
60-
year: 43875,
58+
project: 'Helix',
59+
created: 2018,
6160
});
6261
expect(response).to.have.status(200);
6362
}).catch((e) => {

0 commit comments

Comments
 (0)