How to use auto-release-sinon - 10 common examples

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 / vislib / __tests__ / visualizations / tile_maps / map.js View on Github external
beforeEach(ngMock.inject(function (Private) {
    // mock parts of leaflet
    leafletMocks.tileLayer = { on: sinon.stub() };
    leafletMocks.map = { on: sinon.stub() };
    leafletStubs.tileLayer = sinon.stub(L, 'tileLayer', _.constant(leafletMocks.tileLayer));
    leafletStubs.map = sinon.stub(L, 'map', _.constant(leafletMocks.map));

    Map = Private(require('ui/vislib/visualizations/_map'));
  }));
github elastic / kibana / src / ui / vislib / __tests__ / visualizations / tile_maps / map.js View on Github external
beforeEach(ngMock.inject(function (Private) {
    // mock parts of leaflet
    leafletMocks.tileLayer = { on: sinon.stub() };
    leafletMocks.map = { on: sinon.stub() };
    leafletStubs.tileLayer = sinon.stub(L, 'tileLayer', _.constant(leafletMocks.tileLayer));
    leafletStubs.map = sinon.stub(L, 'map', _.constant(leafletMocks.map));

    Map = Private(require('ui/vislib/visualizations/_map'));
  }));
github elastic / kibana / src / ui / public / directives / __tests__ / validate_query.js View on Github external
ngMock.inject(function ($injector, _$rootScope_, _$compile_, _$timeout_, _Promise_, _Private_, _config_) {
    $timeout = _$timeout_;
    $compile = _$compile_;
    Promise = _Promise_;
    Private = _Private_;
    config = _config_;

    // Give us a scope
    $rootScope = _$rootScope_;

    var es = $injector.get('es');
    mockValidateQuery = sinon.stub(es.indices, 'validateQuery');
  });
};
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 / index_patterns / __tests__ / _index_pattern.js View on Github external
it('should increment the poplarity count by default', function () {
      var saveSpy = sinon.stub(indexPattern, 'save');
      indexPattern.fields.forEach(function (field, i) {
        var oldCount = field.count;

        indexPattern.popularizeField(field.name);

        expect(saveSpy.callCount).to.equal(i + 1);
        expect(field.count).to.equal(oldCount + 1);
      });
    });
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);
    });
  });

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