wip: first draft for jest test EventManager
This commit is contained in:
parent
56443f2b71
commit
ef5e4acb90
|
@ -0,0 +1,16 @@
|
|||
import { EventManager } from "./EventManager";
|
||||
|
||||
// https://stackoverflow.com/questions/51418086/jest-expected-mock-function-to-have-been-called-but-it-was-not-called
|
||||
describe('Event Manager', () => {
|
||||
|
||||
it('addEvent should call appropriate REST APIs', () => {
|
||||
// FIXME: extract to beforeEach
|
||||
const em = new EventManager;
|
||||
const newEntry = EventManager.eventFromDefault()
|
||||
newEntry.state.publishYoutube = false
|
||||
|
||||
expect(em.pu).toHaveBeenCalledTimes(1)
|
||||
expect(client.publish).toHaveBeenCalledTimes(1)
|
||||
expect(client.publish).toBeCalledWith('button/islow', '{true}', {qos: 1})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue