mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
24 lines
625 B
TypeScript
24 lines
625 B
TypeScript
import { expect } from 'chai'
|
|
import 'mocha'
|
|
import { Item } from 'rss-parser'
|
|
import { isOldItem } from '../src'
|
|
|
|
describe('isOldItem', () => {
|
|
it('returns true if item is older than 1 day', () => {
|
|
const item = {
|
|
pubDate: '2020-01-01',
|
|
} as Item
|
|
const lastFetchedAt = Date.now()
|
|
|
|
expect(isOldItem(item, lastFetchedAt)).to.be.true
|
|
})
|
|
|
|
it('returns true if item was published at the last fetched time', () => {
|
|
const lastFetchedAt = Date.now()
|
|
const item = {
|
|
pubDate: new Date(lastFetchedAt).toISOString(),
|
|
} as Item
|
|
|
|
expect(isOldItem(item, lastFetchedAt)).to.be.true
|
|
})
|
|
})
|