Esempio n. 1
0
 it("should be callable with no args & perform a reload", function () {
     browserSync.reload();
     sinon.assert.calledWithExactly(emitterStub, "browser:reload");
 });
 it('_deleteExtension should be called when extension is not essential and extension is available', () => {
   accountExtension._addOrDeleteExtension(false, true);
   sinon.assert.called(accountExtension._deleteExtension);
 });
 it('_addExtension should not be called when extension is not essential and extension is not available', async () => {
   accountExtension._addOrDeleteExtension(false, false);
   sinon.assert.notCalled(accountExtension._addExtension);
 });
 .then(() => {
     sinon.assert.calledOnce(mockGeneratorFunction);
     sinon.assert.calledWith(mockGeneratorFunction, mockApi);
     sinon.assert.calledOnce(bundle.doIt6);
     sinon.assert.calledWith(bundle.doIt6, transactions[0]);
 });
 it('_initClientService should be called once', () => {
   sinon.stub(environment, '_shouldInit').callsFake(() => true);
   sinon.stub(environment, '_initClientService');
   environment._onStateChange();
   sinon.assert.calledOnce(environment._initClientService);
 });
 it('should call #onSubmit when the add collection button is clicked', function () {
   wrapper.find('form').simulate('submit');
   sinon.assert.calledOnce(onSubmitStub);
 });
 it('should call #handleDescriptionInputChange when a user changes text in the description input', function () {
   wrapper.find('textarea.collection-create-form__input--description').simulate('change');
   sinon.assert.calledOnce(handleDescriptionInputChangeStub);
 });
 test('when called should call connection.publish', function(){
     sut.publish(busRequest, connection, queue, objCallback);
     sinon.assert.calledWithExactly(connection.publish, queueName, JSON.stringify(request), null, sinon.match.func);
 });
		test('Should close the queue once message has bene published', function () {
			connection.publish.yields();
			sut.publish(busRequest, connection, queue);
			sinon.assert.calledOnce(queue.close);
		});
Esempio n. 10
0
 .expect((response) => {
     sinon.assert.calledOnce(this.templates.films);
 }).end(done);
Esempio n. 11
0
File: chai.js Progetto: leftees/hugs
function exportAsserts(hugged) {
  sinon.assert.expose(chai.assert, { prefix: '' });
  hugged.assert = chai.assert;
  hugged.chai = chai;
}
Esempio n. 12
0
 .expect((response) => {
     sinon.assert.calledOnce(this.db.getPopular);
     sinon.assert.calledWith(this.db.getPopular, 30);
 }).end(done);
Esempio n. 13
0
 it("should accept an array of file paths as strings", function () {
     browserSync.reload(["index.html", "css/core.css"]);
     sinon.assert.calledWithExactly(emitterStub, "browser:reload");
 });
Esempio n. 14
0
 it("only calls reload once if the array contains a filepath that will cause a reload", function () {
     browserSync.reload(["css/core.css", "index.html"]);
     sinon.assert.calledOnce(emitterStub);
 });
Esempio n. 15
0
 it('makes HTTP call', async () => {
   await savedObjectsClient.get(doc.type, doc.id);
   sinon.assert.calledOnce($http);
 });
Esempio n. 16
0
 function assertResponseWith(res, expectedStatus, responseBody) {
     sinon.assert.calledOnce(res.status);
     sinon.assert.calledWith(res.status, expectedStatus);
     sinon.assert.calledOnce(responseBody);
 }
Esempio n. 17
0
 it('makes HTTP call', () => {
   savedObjectsClient.delete('index-pattern', 'logstash-*');
   sinon.assert.calledOnce($http);
 });
'use strict';

const assert = require('chai').assert;
const mockery = require('mockery');
const sinon = require('sinon');

sinon.assert.expose(assert, { prefix: '' });

describe('Template Factory', () => {
    const name = 'testTemplate';
    const namespace = 'namespace';
    const version = '1.3';
    const maintainer = '*****@*****.**';
    const description = 'this is a template';
    const labels = ['test', 'beta'];
    const templateConfig = { image: 'node:6' };
    const pipelineId = 123;
    const metaData = {
        name,
        version,
        maintainer,
        description,
        labels,
        config: templateConfig,
        pipelineId
    };
    let TemplateFactory;
    let datastore;
    let templateTagFactoryMock;
    let factory;
    let Template;
 it('should call #handleNameInputChange when a user changes text in the name input', function () {
   wrapper.find('input.collection-create-form__input--name').simulate('change');
   sinon.assert.calledOnce(handleNameInputChangeStub);
 });
Esempio n. 20
0
 .then((res) => {
   assert.equal(res.status, 302);
   assert.equal(res.headers.location, 'http://www.bbc.co.uk/programmes/b06ymzly');
   sinon.assert.notCalled(iblClient.getProgrammeEpisodes);
 });
Esempio n. 21
0
  it('consumes index names and scrolls completely before continuing', async () => {
    const stats = createStubStats();
    let checkpoint = Date.now();
    const client = createStubClient([
      async (name, params) => {
        expect(name).to.be('search');
        expect(params).to.have.property('index', 'index1');
        await delay(200);
        return {
          _scroll_id: 'index1ScrollId',
          hits: { total: 2, hits: [ { _id: 1 } ] }
        };
      },
      async (name, params) => {
        expect(name).to.be('scroll');
        expect(params).to.have.property('scrollId', 'index1ScrollId');
        expect(Date.now() - checkpoint).to.not.be.lessThan(200);
        checkpoint = Date.now();
        await delay(200);
        return { hits: { total: 2, hits: [ { _id: 2 } ] } };
      },
      async (name, params) => {
        expect(name).to.be('search');
        expect(params).to.have.property('index', 'index2');
        expect(Date.now() - checkpoint).to.not.be.lessThan(200);
        checkpoint = Date.now();
        await delay(200);
        return { hits: { total: 0, hits: [] } };
      }
    ]);

    const docRecords = await createPromiseFromStreams([
      createListStream([
        'index1',
        'index2',
      ]),
      createGenerateDocRecordsStream(client, stats),
      createConcatStream([])
    ]);

    expect(docRecords).to.eql([
      {
        type: 'doc',
        value: {
          index: undefined,
          type: undefined,
          id: 1,
          source: undefined
        }
      },
      {
        type: 'doc',
        value: {
          index: undefined,
          type: undefined,
          id: 2,
          source: undefined
        }
      },
    ]);
    sinon.assert.calledTwice(stats.archivedDoc);
  });
Esempio n. 22
0
 .then(() => {
   sinon.assert.calledWith(iblClient.getNextEpisode, 'b06ymzly', {
     lang: 'ga'
   });
 });
Esempio n. 23
0
 it("should exit without BS being started", function () {
     var stub = sinon.stub(process, "exit");
     browserSync.exit();
     sinon.assert.calledOnce(stub);
     stub.restore();
 });
Esempio n. 24
0
 ratings.removeForModule('node-red-dashboard').then(function () {
     sinon.assert.calledWith(dbRemove, { module: 'node-red-dashboard' });
     done();
 });
 it('_initClientService should Not be called', () => {
   sinon.stub(environment, '_shouldInit').callsFake(() => false);
   sinon.stub(environment, '_initClientService');
   environment._onStateChange();
   sinon.assert.notCalled(environment._initClientService);
 });
Esempio n. 26
0
 ratings.save(testRating).then(function () {
     sinon.assert.calledWith(dbUpdate,
         { module: testRating.module, user: testRating.user }, testRating, { upsert: true });
     done();
 }).otherwise(function (err) {
 it('_deleteExtension should not be called when extension is essential and extension is available', async () => {
   accountExtension._addOrDeleteExtension(true, true);
   sinon.assert.notCalled(accountExtension._deleteExtension);
 });
Esempio n. 28
0
 ratings.remove(testRating).then(function () {
     sinon.assert.calledWith(dbRemove, testRating);
     done();
 }).otherwise(function (err) {
Esempio n. 29
0
File: take.js Progetto: MattMS/ramda
 it('steps correct number of times', function() {
   var spy = sinon.spy();
   R.into([], R.compose(R.map(spy), R.take(2)), [1, 2, 3]);
   sinon.assert.calledTwice(spy);
 });
Esempio n. 30
0
 .then(() => {
     sinon.assert.calledOnce(mockBusinessNetworkConnection.disconnect);
     businessNetworkConnectionWrapper.connected.should.be.false;
     businessNetworkConnectionWrapper.connecting.should.be.false;
 });