0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
matthewp 2022-07-13 20:39:29 +00:00 committed by fredkbot
parent cd2dbfedb1
commit fa8ec57f16
2 changed files with 14 additions and 10 deletions

View file

@ -152,9 +152,11 @@ const requiredFields = Object.freeze(['link', 'title']);
// Perform validation to make sure all required fields are passed.
function validate(item: RSSFeedItem) {
for(const field of requiredFields) {
if(!(field in item)) {
throw new Error(`@astrojs/rss: Required field [${field}] is missing. RSS cannot be generated without it.`);
for (const field of requiredFields) {
if (!(field in item)) {
throw new Error(
`@astrojs/rss: Required field [${field}] is missing. RSS cannot be generated without it.`
);
}
}
}

View file

@ -131,16 +131,18 @@ describe('rss', () => {
title: 'Your Website Title',
description: 'Your Website Description',
site: 'https://astro-demo',
items: [{
pubDate: new Date(),
title: 'Some title',
slug: 'foo'
}]
items: [
{
pubDate: new Date(),
title: 'Some title',
slug: 'foo',
},
],
});
chai.expect(false).to.equal(true, 'Should have errored');
} catch(err) {
} catch (err) {
chai.expect(err.message).to.contain('Required field [link] is missing');
}
});
})
});
});