How to use the sinon.sandbox 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 abecms / abecms / tests / unit / cms / operations / create.js View on Github external
it('cmsOperations.create()', function(done) {
    // stub
    var s = sinon.sandbox.create();
    s.stub(abeExtend.hooks.instance, 'trigger', function (str, obj, body, json) {
      return str, obj;
    }.bind(this));
    s.stub(coreUtils.slug, 'clean', function (p) { return p; }.bind(this));
    s.stub(Manager.instance, 'postExist', function (p) { return false; }.bind(this));
    s.stub(cmsData.metas, 'create', function (json, template, postUrl) { return json; }.bind(this));
    s.stub(cmsTemplates.template, 'getTemplate', function () { return this.fixture.htmlArticle; }.bind(this));
    s.stub(cmsData.values, 'removeDuplicate', function (templateText, json) { return json; }.bind(this));
    s.stub(cmsOperations.post, 'draft', function () {
      return Promise.resolve({json: JSON.parse(JSON.stringify(this.fixture.jsonArticle))})
    }.bind(this));

    cmsOperations.create('article', '/article-2.html', JSON.parse(JSON.stringify(this.fixture.jsonArticle)))
      .then(function(resSave) {
        var json = path.join(Manager.instance.pathData, resSave.abe_meta.latest.abeUrl.replace('.html', '.json'))
github linode / manager / test / linodes / linode / layouts / ResizePage.spec.js View on Github external
describe('linodes/linode/layouts/ResizePage', () => {
  const sandbox = sinon.sandbox.create();

  const dispatch = sandbox.spy();

  afterEach(() => {
    dispatch.reset();
    sandbox.restore();
  });

  it('resize the linode', async () => {
    const page = mount(
      
    );
github Laverna / laverna / test / tape / components / markdown / markdown.js View on Github external
test('markdown/Markdown: before()', t => {
    sand = sinon.sandbox.create();
    t.end();
});
github prebid / Prebid.js / test / spec / modules / nanointeractiveBidAdapter_spec.js View on Github external
function setUpMocks() {
        sinon.sandbox.restore();
        sandbox = sinon.sandbox.create();
        sandbox.stub(utils, 'getOrigin').callsFake(() => getMocks()['originAddress']);
        sandbox.stub(utils, 'deepAccess').callsFake(() => getMocks()['windowLocationAddress']);

        sandbox.stub(utils, 'getParameterByName').callsFake((arg) => {
          switch (arg) {
            case CATEGORY_NAME_QUERY_PARAM:
              return CATEGORY_VALUE;
            case NQ_NAME_QUERY_PARAM:
              return NQ_VALUE;
          }
        });
      }
github peeriodproject / core / test / core / search / SearchMessageBridge.js View on Github external
beforeEach(function () {
        sandbox = sinon.sandbox.create();

        searchRequestManagerStub = testUtils.stubPublicApi(sandbox, SearchRequestManager);

        searchResponseManagerStub = testUtils.stubPublicApi(sandbox, SearchResponseManager);
    });
github bigearth / bitbox-cli / test / Blockchain.js View on Github external
    beforeEach(() => sandbox = sinon.sandbox.create());
    afterEach(() => sandbox.restore());
github stryker-mutator / stryker / test / unit / ReporterOrchestratorSpec.ts View on Github external
beforeEach(() => {
    sandbox = sinon.sandbox.create();
    broadcastReporterMock = sandbox.stub(broadcastReporter, 'default');
    captureTTY();
  });
github sripberger / gene-lib / test / setup.js View on Github external
beforeEach(function() {
	global.sandbox = sinon.sandbox.create();
});
github linode / manager / src / volumes / components / VolumesList.spec.js View on Github external
describe('linodes/volumes/components/VolumesList', () => {
  const sandbox = sinon.sandbox.create();

  afterEach(() => {
    sandbox.restore();
  });

  const dispatch = sandbox.spy();

  it.skip('renders a table', () => {
    const wrapper = shallow(
      
    );
github NaturalNode / natural / spec / bayes_classifier_spec.js View on Github external
beforeEach(function () {
            sandbox = sinon.sandbox.create();
        });