This commit is contained in:
2017-02-22 22:26:23 +01:00
commit 220406f730
5 changed files with 2139 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
const openingTimes = require('../index.js')
describe('calculating opening times', () => {
it('is early morning, waiting in front of the door', () => {
const date = new Date(2017, 1, 23, 6, 0, 0, 0)
const resultStr = openingTimes(date)
expect(resultStr).toBe('öffnet in 01:00')
})
it('is early morning, waiting in front of the door, hoping someone opens early', () => {
const date = new Date(2017, 1, 23, 6, 58, 59, 0)
const resultStr = openingTimes(date)
expect(resultStr).toBe('öffnet in 00:01')
})
it('is sunday...', () => {
const date = new Date(2017, 1, 19, 16, 0, 0, 0)
const resultStr = openingTimes(date)
expect(resultStr).toBe('zur zeit geschlossen, öffnet wieder in 15:00')
})
it('is late night friday', () => {
const date = new Date(2017, 1, 18, 23, 30, 0, 0)
const resultStr = openingTimes(date)
expect(resultStr).toBe('zur zeit geschlossen, öffnet wieder in 31:30')
})
it('should open in 9 h', () => {
const date = new Date(2017, 1, 22, 22, 0, 0, 0)
const resultStr = openingTimes(date)
expect(resultStr).toBe('zur zeit geschlossen, öffnet wieder in 09:00')
})
it('is opened', () => {
const date = new Date(2017, 1, 22, 14, 5, 0, 0)
const resultStr = openingTimes(date)
expect(resultStr).toBe('noch 05:55 geöffnet')
})
it('is still opened, but hurry up', () => {
const date = new Date(2017, 1, 22, 19, 59, 55, 0)
const resultStr = openingTimes(date)
expect(resultStr).toBe('noch 00:00 geöffnet')
})
})