feed-validator
Version:
Simple validator for RSS, Atom or opensearch.xml that using validator.w3.org/feed and plugins
93 lines (90 loc) • 3.73 kB
JavaScript
// jscs:disable maximumLineLength
exports.invalidData = {
feedJson: {
OpenSearchDescription: {
$: {xmlns: 'http://a9.com/-/spec/opensearch/1.1/'},
ShortName: ['Яндекс'],
Description: ['Воспользуйтесь Яндексом для поиска в Интернете.'],
Image: [''],
Url: ['', ''],
InputEncoding: ['UTF-8']
}
},
feedXml: '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">\n' +
'<ShortName>Яндекс</ShortName>\n' +
'<Description>Воспользуйтесь Яндексом для поиска в Интернете.</Description>\n' +
'<Image width="16" height="16" type="image/x-icon">https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico</Image>\n' +
'<Url type="text/html" template="https://yandex.ru/yandsearch?text={searchTerms}&from=os&clid=1836588"/>\n' +
'<Url type="application/x-suggestions+json" method="GET" template="https://suggest.yandex.ru/suggest-ff.cgi?part={searchTerms}&uil=ru&v=3&sn=5&lr=213&yu=898324731404302355"/>\n' +
'<InputEncoding>UTF-8</InputEncoding>\n' +
'</OpenSearchDescription>',
isValid: false,
errors: [
{
level: 'error',
type: 'MissingDescription',
line: 23,
column: 0,
text: 'Missing channel element: description',
msgcount: 1,
backupcolumn: 0,
backupline: 23,
element: 'description',
parent: 'channel'
}
],
warnings: [
{
level: 'warning',
type: 'MissingDescription',
line: 23,
column: 0,
text: 'Missing channel element: description',
msgcount: 1,
backupcolumn: 0,
backupline: 23,
element: 'description',
parent: 'channel'
}
],
info: [
{
level: 'info',
type: 'MissingDescription',
line: 23,
column: 0,
text: 'Missing channel element: description',
msgcount: 1,
backupcolumn: 0,
backupline: 23,
element: 'description',
parent: 'channel'
}
]
};
exports.validData = {
feedJson: {
OpenSearchDescription: {
$: {xmlns: 'http://a9.com/-/spec/opensearch/1.1/'},
ShortName: ['Яндекс'],
Description: ['Воспользуйтесь Яндексом для поиска в Интернете.'],
Image: [''],
Url: ['', ''],
InputEncoding: ['UTF-8']
}
},
feedXml: ' \n' +
'<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">\n' +
'<ShortName>Яндекс</ShortName>\n' +
'<Description>Воспользуйтесь Яндексом для поиска в Интернете.</Description>\n' +
'<Image width="16" height="16" type="image/x-icon">https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico</Image>\n' +
'<Url type="text/html" template="https://yandex.ru/yandsearch?text={searchTerms}&from=os&clid=1836588"/>\n' +
'<Url type="application/x-suggestions+json" method="GET" template="https://suggest.yandex.ru/suggest-ff.cgi?part={searchTerms}&uil=ru&v=3&sn=5&lr=213&yu=898324731404302355"/>\n' +
'<InputEncoding>UTF-8</InputEncoding>\n' +
'</OpenSearchDescription>',
isValid: true,
errors: [],
warnings: [],
info: []
};
\n' +
'