communiapp-event-planner/src/api/EventManager.spec.ts

17 lines
642 B
TypeScript

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})
})
})