How to use the sandbox function from sinon

Find comprehensive JavaScript sinon.sandbox code examples handpicked from public code repositorys.

48
49
50
51
52
53
54
55
56
The `sinon.sandbox.create(config)` method is often an integration feature, and can be used for scenarios including a global object to coordinate all fakes through.

Sandboxes are partially configured by default such that calling:

```javascript
var sandbox = sinon.sandbox.create({});
```

will merge in extra defaults analogous to:
fork icon810
star icon1
watch icon3

+ 13 other calls in file

53
54
55
56
57
58
59
60
61

var sandbox;
var app;

beforeEach(function() {
  sandbox = sinon.sandbox.create();
  test_utils.fakeTimers(sandbox);
  // Re-create stub process for each test to avoid accumulating listeners.
  wpt_client.process = new events.EventEmitter();
fork icon700
star icon1
watch icon6

+ 3 other calls in file

142
143
144
145
146
147
148
149
150
151
  return path.join.apply(path, [ suiteRoot ].concat([].slice.call(arguments)));
};

testSuite.getSinonSandbox = function() {
  if (!sandbox) {
    sandbox = sinon.sandbox.create({ useFakeTimers: false, useFakeServer: false });
  }

  return sandbox;
};
fork icon147
star icon8
watch icon4

13
14
15
16
17
18
19
20
21
22


// ------------------------------------------------------------------------------
// Helpers
// ------------------------------------------------------------------------------
var sandbox = sinon.sandbox.create(),
        boxClientFake = leche.fake(BoxClient.prototype),
        Comments,
        comments,
        testQS = { testQSKey: 'testQSValue' },
fork icon123
star icon0
watch icon2

+ 3 other calls in file

13
14
15
16
17
18
19
20
21
22
    tenantUrl: 'http://brightspace.localhost/',
    maxAge: 3600
};

describe('LandlordClient', function() {
    let sandbox = __sinon__.sandbox.create();

    beforeEach(function() {
        sandbox = __sinon__.sandbox.create();
    });
fork icon5
star icon0
watch icon1

+ 7 other calls in file