invoke-with-error-handling.spec.js 592 B

1234567891011121314151617181920212223
  1. import Vue from 'vue'
  2. import { invokeWithErrorHandling } from 'core/util/error'
  3. describe('invokeWithErrorHandling', () => {
  4. if (typeof Promise !== 'undefined') {
  5. it('should errorHandler call once when nested calls return rejected promise', done => {
  6. let times = 0
  7. Vue.config.errorHandler = function () {
  8. times++
  9. }
  10. invokeWithErrorHandling(() => {
  11. return invokeWithErrorHandling(() => {
  12. return Promise.reject(new Error('fake error'))
  13. })
  14. }).then(() => {
  15. expect(times).toBe(1)
  16. done()
  17. })
  18. })
  19. }
  20. })