Possibly unhandled rejection error when testing canceled interval in angularjs

I would like to unit test a feature where a promise created with $interval is canceled inside its callback, but I end with the error:

Possibly unhandled rejection: canceled

Concretely, what I want to do is similar to the following snippet of code :

it('should check canceled interval', function() {
    spyOn($interval, 'cancel').and.callThrough();
    var count = 0;
    var interval = $interval(function() {
        if (count > 10) {
    }, 10);

I can’t post the real production code for security reason, but as soon as i’ll be able to make the snippet above work, I’ll be able to adapt my code.

Source: AngularJS