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:
parent
21cd347aa4
commit
a04a88d2cd
|
|
@ -51,10 +51,12 @@ module.exports = async (ctx, next) => {
|
|||
});
|
||||
}
|
||||
|
||||
const routeTtl = (config.cache.routeExpire / 60) | 0;
|
||||
|
||||
const data = {
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
updated: new Date().toISOString(),
|
||||
ttl: config.cache.routeExpire,
|
||||
ttl: routeTtl,
|
||||
...ctx.state.data,
|
||||
};
|
||||
if (template) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ async function checkRSS(response) {
|
|||
expect(parsed.description).toEqual(expect.any(String));
|
||||
expect(parsed.link).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));
|
||||
checkDate(parsed.lastBuildDate);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue