forked from boyska/radiomanifest.js
some more tests for schedule
This commit is contained in:
parent
c139b1faef
commit
a19dbc8de1
1 changed files with 46 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
const ICAL = require('ical.js')
|
||||||
|
|
||||||
const radiomanifest = require('../radiomanifest.js')
|
const radiomanifest = require('../radiomanifest.js')
|
||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
chai.use(require('chai-as-promised'))
|
chai.use(require('chai-as-promised'))
|
||||||
|
@ -21,5 +23,49 @@ describe('examples/' + exampleName, () => {
|
||||||
assert.equal(show.getSchedule(), null)
|
assert.equal(show.getSchedule(), null)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('schedule', () => {
|
||||||
|
it('should find many event', async () => {
|
||||||
|
const rm = await radiomanifest.get(url)
|
||||||
|
assert.isAbove(rm.getSchedule().getEvents().length, 1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('monday at 8PM, "Entropia Massima" is going on', async () => {
|
||||||
|
const rm = await radiomanifest.get(url)
|
||||||
|
const rs = rm.getSchedule()
|
||||||
|
const now = new ICAL.Time({
|
||||||
|
year: 2022,
|
||||||
|
month: 1,
|
||||||
|
day: 31,
|
||||||
|
hour: 20,
|
||||||
|
minute: 10,
|
||||||
|
second: 0,
|
||||||
|
isDate: false
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const vevent = rs.getNowEvent(now)
|
||||||
|
assert.notEqual(vevent, null)
|
||||||
|
const show = rs.getNowShow(now)
|
||||||
|
assert.notEqual(show, null)
|
||||||
|
assert.equal(show.getName(), 'Entropia Massima')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('At 1AM, nothing is going on', async () => {
|
||||||
|
const rm = await radiomanifest.get(url)
|
||||||
|
const rs = rm.getSchedule()
|
||||||
|
const now = new ICAL.Time({
|
||||||
|
year: 2022,
|
||||||
|
month: 1,
|
||||||
|
day: 31,
|
||||||
|
hour: 1,
|
||||||
|
minute: 0,
|
||||||
|
second: 0,
|
||||||
|
isDate: false
|
||||||
|
});
|
||||||
|
const ev = rs.getNowEvent(now)
|
||||||
|
assert.equal(ev, null)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue