How to use the auto-release-sinon.spy function in auto-release-sinon

To help you get started, we’ve selected a few auto-release-sinon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / src / ui / filter_bar / __tests__ / _invertFilters.js View on Github external
it('should fire the update and fetch events', function () {
      var emitSpy = sinon.spy(queryFilter, 'emit');
      appState.filters = filters;

      // set up the watchers
      $rootScope.$digest();
      queryFilter.invertFilter(filters[1]);
      // trigger the digest loop to fire the watchers
      $rootScope.$digest();

      expect(emitSpy.callCount).to.be(2);
      expect(emitSpy.firstCall.args[0]).to.be('update');
      expect(emitSpy.secondCall.args[0]).to.be('fetch');
    });
  });
github elastic / kibana / src / ui / filter_bar / __tests__ / _toggleFilters.js View on Github external
it('should fire the update and fetch events', function () {
      var emitSpy = sinon.spy(queryFilter, 'emit');
      appState.filters = filters;
      $rootScope.$digest();

      queryFilter.toggleFilter(filters[1]);
      $rootScope.$digest();

      expect(emitSpy.callCount).to.be(2);
      expect(emitSpy.firstCall.args[0]).to.be('update');
      expect(emitSpy.secondCall.args[0]).to.be('fetch');
    });
github elastic / kibana / src / ui / filter_bar / __tests__ / _removeFilters.js View on Github external
it('should fire the update and fetch events', function () {
      var emitSpy = sinon.spy(queryFilter, 'emit');
      appState.filters = filters;
      $rootScope.$digest();

      queryFilter.removeFilter(filters[0]);
      $rootScope.$digest();

      expect(emitSpy.callCount).to.be(2);
      expect(emitSpy.firstCall.args[0]).to.be('update');
      expect(emitSpy.secondCall.args[0]).to.be('fetch');
    });
github elastic / kibana / src / ui / filter_bar / __tests__ / _pinFilters.js View on Github external
it('should only fire the update event', function () {
      var emitSpy = sinon.spy(queryFilter, 'emit');
      var filter = appState.filters[1];
      $rootScope.$digest();

      queryFilter.pinFilter(filter);
      $rootScope.$digest();

      expect(emitSpy.callCount).to.be(1);
      expect(emitSpy.firstCall.args[0]).to.be('update');
    });
  });
github elastic / kibana / src / ui / utils / __tests__ / SimpleEmitter.js View on Github external
it('always emits the handlers that were initially registered', function () {

      var destructive = sinon.spy(function () {
        emitter.removeAllListeners();
        expect(emitter.listenerCount()).to.be(0);
      });
      var stub = sinon.stub();

      emitter.on('run', destructive).on('run', stub).emit('run');

      expect(destructive).to.have.property('callCount', 1);
      expect(stub).to.have.property('callCount', 1);
    });
github elastic / kibana / src / ui / vislib / __tests__ / lib / resize_checker.js View on Github external
it('clears the timeout', function () {
      var spy = sinon.spy(window, 'clearTimeout');
      checker.destroy();
      expect(spy).to.have.property('callCount', 1);
    });
  });
github elastic / kibana / src / ui / vislib / components / tooltip / __tests__ / positioning.js View on Github external
it('should measure the outer-size of the tooltip using an un-obstructed clone', function () {
      var w = sinon.spy($.fn, 'outerWidth');
      var h = sinon.spy($.fn, 'outerHeight');

      posTT.getTtSize($tooltip.html(), $sizer);

      [w, h].forEach(function (spy) {
        expect(spy).to.have.property('callCount', 1);
        var matchHtml = w.thisValues.filter(function ($t) {
          return !$t.is($tooltip) && $t.html() === $tooltip.html();
        });
        expect(matchHtml).to.have.length(1);
      });
    });
  });
github elastic / kibana / src / ui / public / agg_response / point_series / __tests__ / _ordered_date_axis.js View on Github external
it('relies on agg.buckets for the interval', function () {
      var args = _.cloneDeep(baseArgs);
      var spy = sinon.spy(args.chart.aspects.x.agg.buckets, 'getInterval');
      orderedDateAxis(args.vis, args.chart);
      expect(spy).to.have.property('callCount', 1);
    });
github elastic / kibana / src / ui / vislib / __tests__ / lib / resize_checker.js View on Github external
beforeEach(ngMock.inject(function (Private) {
    ResizeChecker = Private(require('ui/vislib/lib/resize_checker'));
    EventEmitter = Private(require('ui/events'));
    reflowWatcher = Private(require('ui/reflow_watcher'));
    reflowSpies.on = sinon.spy(reflowWatcher, 'on');
    reflowSpies.off = sinon.spy(reflowWatcher, 'off');

    var $el = $(document.createElement('div'))
    .appendTo('body')
    .css('visibility', 'hidden')
    .get(0);

    checker = new ResizeChecker($el);
  }));
github elastic / kibana / src / ui / doc_title / __tests__ / doc_title.js View on Github external
return function ($delegate) {
      sinon.spy($delegate, prop);
      return $delegate;
    };
  }

auto-release-sinon

Basic sinon wrapper that automatically releases it's stubs, works with mocha's BDD interface

Apache-2.0
Latest version published 9 years ago

Package Health Score

42 / 100
Full package analysis

Popular auto-release-sinon functions