mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 23:59:56 +08:00
fix: value of rss TTL tag (#2297)
* fix value of rss TTL tag * fix test algorithm for rss ttl tag
This commit is contained in:
@@ -51,10 +51,12 @@ module.exports = async (ctx, next) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const routeTtl = (config.cache.routeExpire / 60) | 0;
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
lastBuildDate: new Date().toUTCString(),
|
lastBuildDate: new Date().toUTCString(),
|
||||||
updated: new Date().toISOString(),
|
updated: new Date().toISOString(),
|
||||||
ttl: config.cache.routeExpire,
|
ttl: routeTtl,
|
||||||
...ctx.state.data,
|
...ctx.state.data,
|
||||||
};
|
};
|
||||||
if (template) {
|
if (template) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ async function checkRSS(response) {
|
|||||||
expect(parsed.description).toEqual(expect.any(String));
|
expect(parsed.description).toEqual(expect.any(String));
|
||||||
expect(parsed.link).toEqual(expect.any(String));
|
expect(parsed.link).toEqual(expect.any(String));
|
||||||
expect(parsed.lastBuildDate).toEqual(expect.any(String));
|
expect(parsed.lastBuildDate).toEqual(expect.any(String));
|
||||||
expect(parsed.ttl).toEqual(config.cache.routeExpire + '');
|
expect(parsed.ttl).toEqual(((config.cache.routeExpire / 60) | 0) + '');
|
||||||
expect(parsed.items).toEqual(expect.any(Array));
|
expect(parsed.items).toEqual(expect.any(Array));
|
||||||
checkDate(parsed.lastBuildDate);
|
checkDate(parsed.lastBuildDate);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user