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:
810
1
3
+ 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();
700
1
6
+ 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; };
147
8
4
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' },
123
0
2
+ 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(); });
5
0
1
+ 7 other calls in file
sinon.stub is the most popular function in sinon (5777 examples)