|
1 | 1 | /* jshint camelcase: false, undef: true, unused: true, browser: true */
|
2 | 2 | /* global module: false, describe: false, it: false, expect: false, beforeEach: false, inject: false, SockJS: false */
|
3 | 3 |
|
4 |
| -var SockJS = require('sockjs-client'); |
| 4 | +const SockJS = require('sockjs-client'); |
| 5 | +const enableUnhandledRejectionTracing = require('../util/unhandledRejectionTracing.js'); |
5 | 6 | require('../../../src/module.js');
|
6 | 7 |
|
7 | 8 | describe('integration of module::vertxEventBusService', function () {
|
8 | 9 |
|
9 | 10 | beforeEach(angular.mock.module('knalli.angular-vertxbus'));
|
10 | 11 |
|
11 | 12 | beforeEach(angular.mock.module('knalli.angular-vertxbus', function ($provide) {
|
| 13 | + enableUnhandledRejectionTracing(angular, $provide); |
12 | 14 | $provide.value('$log', {
|
13 | 15 | log: function () {},
|
14 | 16 | debug: function () {},
|
@@ -229,10 +231,10 @@ describe('integration of module::vertxEventBusService', function () {
|
229 | 231 | describe('should replay queued items', function () {
|
230 | 232 | it('when eventbus is reopened', function (done) {
|
231 | 233 | setTimeout(function () {
|
232 |
| - vertxEventBusService.send('xyz', {data : 0}); |
233 |
| - vertxEventBusService.send('xyz', {data : 1}); |
234 |
| - vertxEventBusService.send('xyz', {data : 2}); |
235 |
| - vertxEventBusService.send('xyz', {data : 3}); |
| 234 | + vertxEventBusService.send('xyz', {data : 0}).then(null, angular.noop); |
| 235 | + vertxEventBusService.send('xyz', {data : 1}).then(null, angular.noop); |
| 236 | + vertxEventBusService.send('xyz', {data : 2}).then(null, angular.noop); |
| 237 | + vertxEventBusService.send('xyz', {data : 3}).then(null, angular.noop); |
236 | 238 |
|
237 | 239 | // fake connect
|
238 | 240 | vertxEventBus.readyState = function () {
|
@@ -562,13 +564,13 @@ describe('integration of module::vertxEventBusService', function () {
|
562 | 564 | expect(typeof promise.finally).to.be('function');
|
563 | 565 | promise.then(function () {
|
564 | 566 | results.then++;
|
565 |
| - }); |
| 567 | + }, angular.noop); // ignore error (because error is expected) |
566 | 568 | promise.catch(function () {
|
567 | 569 | results.catch++;
|
568 | 570 | });
|
569 | 571 | promise.finally(function () {
|
570 | 572 | results.finally++;
|
571 |
| - }); |
| 573 | + }).then(null, angular.noop); // ignore error (because error is expected) |
572 | 574 | $rootScope.$apply();
|
573 | 575 | setTimeout(function () {
|
574 | 576 | expect(results.then).to.be(0);
|
@@ -618,16 +620,16 @@ describe('integration of module::vertxEventBusService', function () {
|
618 | 620 | expect(typeof promise.finally).to.be('function');
|
619 | 621 | promise.then(function () {
|
620 | 622 | results.then++;
|
621 |
| - }); |
| 623 | + }, angular.noop); // ignore error (because error is expected) |
622 | 624 | promise.catch(function () {
|
623 | 625 | results.catch++;
|
624 | 626 | });
|
625 | 627 | promise.finally(function () {
|
626 | 628 | results.finally++;
|
627 |
| - }); |
| 629 | + }).then(null, angular.noop); // ignore error (because error is expected) |
628 | 630 | $rootScope.$apply();
|
629 | 631 | setTimeout(function () {
|
630 |
| - window.console.log(results); |
| 632 | + window.console.warn(results); |
631 | 633 | expect(results.then).to.be(0);
|
632 | 634 | expect(results.catch).to.be(1);
|
633 | 635 | expect(results.finally).to.be(1);
|
|
0 commit comments