mirror of
https://github.com/github/codeql-action.git
synced 2025-12-26 17:20:10 +08:00
36 lines
981 B
JavaScript
36 lines
981 B
JavaScript
"use strict";
|
|
|
|
const behavior = require("./sinon/behavior");
|
|
const createSandbox = require("./sinon/create-sandbox");
|
|
const extend = require("./sinon/util/core/extend");
|
|
const fakeTimers = require("./sinon/util/fake-timers");
|
|
const Sandbox = require("./sinon/sandbox");
|
|
const stub = require("./sinon/stub");
|
|
const promise = require("./sinon/promise");
|
|
|
|
/**
|
|
* @returns {object} a configured sandbox
|
|
*/
|
|
module.exports = function createApi() {
|
|
const apiMethods = {
|
|
createSandbox: createSandbox,
|
|
match: require("@sinonjs/samsam").createMatcher,
|
|
restoreObject: require("./sinon/restore-object"),
|
|
|
|
expectation: require("./sinon/mock-expectation"),
|
|
|
|
// fake timers
|
|
timers: fakeTimers.timers,
|
|
|
|
addBehavior: function (name, fn) {
|
|
behavior.addBehavior(stub, name, fn);
|
|
},
|
|
|
|
// fake promise
|
|
promise: promise,
|
|
};
|
|
|
|
const sandbox = new Sandbox();
|
|
return extend(sandbox, apiMethods);
|
|
};
|