uci-interrupt/test/interrupt.test.js

36 lines
836 B
JavaScript
Raw Normal View History

2017-01-11 15:11:34 -08:00
'use strict'
const expect = require('chai').expect,
2017-01-21 12:21:16 -08:00
Interrupt = require('../').Interrupt
2017-01-11 15:11:34 -08:00
//time-stamp for use when watching to distinguish reruns in console
// place in alpha first file only
let date = new Date(Date.now())
console.log(date.getMinutes(), "\:", date.getSeconds())
2017-01-21 12:21:16 -08:00
let inter17 = new Interrupt(17, { hook: 'a hook to something to do' })
2017-01-11 15:11:34 -08:00
2017-01-21 12:21:16 -08:00
// console.log('inter17', inter17)
2017-01-11 15:11:34 -08:00
2017-01-21 12:21:16 -08:00
inter17.on('fired', hook => {
console.log('Listener fired and returned:', hook)
2017-01-11 15:11:34 -08:00
})
2017-01-21 12:21:16 -08:00
inter17.init()
.then((resp) => {
console.log('return from init()', resp)
setInterval(function () {
inter17.fire()
}, 1000)
})
.catch(err => console.log("error:", err))
// describe('Interrupt Class', function () {
//
// it('can be manually fired', function () {
// expect(hello('Forest Gump')).to.equal()
// })
//
// })
// })