How to use the sinon.assert function in sinon

To help you get started, we’ve selected a few 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 bbc / childrens-games-genie / test / components / overlays / pause.spec.js View on Github external
it("keeps all audio playing", () => {
            sinon.assert.calledOnce(mockGame.sound.unsetMute);
        });
github edjafarov / PromisePipe / tests / security.PromisePipe.spec.js View on Github external
it('should not allow omit execution of some chains', function(){
			sinon.assert.calledOnce(fn1);
			sinon.assert.calledOnce(catchFn);
      expect(catchFn.getCall(0).args[0]).to.have.property('error','Non-consistent pipe call, message is trying to omit chains')

		})
	})
github sadjow / makesure / test / makesure.js View on Github external
it("executes the functions to define validations", function(){
      var spy = sinon.spy();
      makesure(spy);
      sinon.assert.called(spy);
    });
  });
github twilio / twilio-video.js / test / unit / spec / connect.js View on Github external
it('should not call .warn on the underlying Log', () => {
        const options = signaling.args[1][1];
        sinon.assert.callCount(options.log.warn, 0);
      });
    });
github LimeChain / etherlime / test / etherlime / cli-commands / history / history.js View on Github external
it('should show history with specific number of records', async function() {
        let loggerSpy = sinon.spy(logger, "log");
        await history.run(1);
        sinon.assert.callCount(loggerSpy, 1);
        loggerSpy.restore()
    });
github ministryofjustice / apvs-external-web / test / unit / routes / apply / eligibility / claim / test-declaration.js View on Github external
.expect(function () {
          sinon.assert.calledWith(stubDeclaration, VALID_DATA['terms-and-conditions-input'])
        })
        .expect('location', `/application-submitted`)
github shakyShane / foxy / test / src / server / middleware.js View on Github external
res.on("data", chunk => {

                assert.include(chunk.toString(), "BrowserSync");
                sinon.assert.calledWith(spy, "called from mw");

                proxy.config.rules.push({
                    match: "<title></title>",
                    replace: "<title>Shane</title>"
                });

                http.get(options, (res) =&gt; {
                    res.on("data", chunk =&gt; {
                        assert.include(chunk.toString(), "<title>Shane</title>");
                        server.close();
                        done();
                    });
                });
            });
        });
github interledger-deprecated / ilp-core / test / coreSpec.js View on Github external
'use strict'

const sinon = require('sinon')
const chai = require('chai')
sinon.assert.expose(chai.assert, { prefix: '' })
const chaiAsPromised = require('chai-as-promised')
chai.use(chaiAsPromised)
const assert = chai.assert

const mockRequire = require('mock-require')
const MockPlugin = require('./mocks/mock-plugin')
const MockClient = require('./mocks/mock-client')

const RoutingTables = require('ilp-routing').RoutingTables
const Core = require('../src/lib/core')

describe('Core', function () {
  beforeEach(function () {
    mockRequire('ilp-plugin-mock', MockPlugin)
    this.tables = new RoutingTables([], 10)
    this.core = new Core({routingTables: this.tables})
github el-davo / platmatic / app / cloud / create-app / create-app.service.spec.ts View on Github external
it('should initialize a new app', () => {
      let instance = {cfInstance: 'test.cloud.com', token: {access_token: 'abc123'} as Token} as Instance;
      let app = {name: 'newApp'};

      createApp(instance, app);

      appsStub.calledOnce.should.equal(true);
      setTokenStub.calledOnce.should.equal(true);
      addStub.calledOnce.should.equal(true);

      sinon.assert.calledWith(appsStub, instance.cfInstance);
      sinon.assert.calledWith(setTokenStub, instance.token);
      sinon.assert.calledWith(addStub, app);
    });
  });
github deepstreamIO / deepstream.io-client-js / src / util / listener.spec.ts View on Github external
it('calls the listen callback', () => {
        sinon.assert.calledOnce(listenCallback)
        sinon.assert.calledWithExactly(listenCallback, subscription, sinon.match.any)
      })