hooks.spec.js 526 B

12345678910111213141516171819202122232425262728293031
  1. import Alpine from 'alpinejs'
  2. import Spruce from '../dist/spruce'
  3. beforeEach(() => {
  4. Spruce.subscribers = []
  5. })
  6. beforeAll(() => {
  7. window.Spruce = Spruce
  8. window.Alpine = Alpine
  9. })
  10. test('.starting() > callbacks are executed', () => {
  11. let fixture = 0;
  12. Spruce.starting(() => fixture++)
  13. Spruce.start()
  14. expect(fixture).toEqual(1)
  15. })
  16. test('.started() > callbacks are executed', () => {
  17. let fixture = 0;
  18. Spruce.started(() => fixture++)
  19. Spruce.start()
  20. expect(fixture).toEqual(1)
  21. })