Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-env mocha */
"use strict";
var assert = require("chai").assert;
var speedomatic = require("speedomatic");
var proxyquire = require("proxyquire").noPreserveCache();
describe("create-market/get-market-creation-cost", function () {
var test = function (t) {
it(t.description, function (done) {
var getMarketCreationCost = proxyquire("../../../src/create-market/get-market-creation-cost", {
"../api": t.stub.api,
});
getMarketCreationCost(t.params, function (err, marketCreationCost) {
t.assertions(err, marketCreationCost);
done();
});
});
};
test({
description: "happy path",
params: {
/* eslint-env mocha */
"use strict";
var assert = require("chai").assert;
var proxyquire = require("proxyquire").noPreserveCache();
var callcount = 0;
describe("trading/order-book/get-order-book-chunked", function () {
var test = function (t) {
it(t.description, function () {
callcount = 0;
var getOrderBookChunked = proxyquire("../../../../src/trading/order-book/get-order-book-chunked", {
"./get-order-book": t.stub.getOrderBook,
"../../api": function () {
return {
Orders: {
getWorseOrderId: t.stub.api.Orders.getWorseOrderId
}
};
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
const { assert } = require('chai');
const proxyquire = require('proxyquire').noPreserveCache();
const sinon = require('sinon');
describe('userAgent, mocked dependency', () => {
let uaParser, userAgent, parserResult;
beforeEach(() => {
uaParser = {
parse: sinon.spy(() => parserResult)
};
userAgent = proxyquire('../../lib/userAgent', {
'node-uap': uaParser
});
});
it(
/* global describe, it, before, assert, promise */
var proxyquire = require('proxyquire').noPreserveCache();
var webdriver = require('selenium-webdriver');
//global.run = function () {};
var fsStub = {
existsSync: function () {
return false;
},
mkdirSync: function (path, perm, cb) {
cb('muhaha');
},
writeFile: function (name, message, cb) {
cb();
}
};
var expect = require('expect.js')
, sinon = require('sinon')
, mock = require('mock-fs')
, proxyquire = require('proxyquire').noPreserveCache()
describe('mplayer has the maximum priority', function(){
var spy, cli
beforeEach(function(){
spy = sinon.stub()
cli = proxyquire('./', { child_process: { spawn: spy }})()
mock({
'./beep.mp3': '',
'mplayer': mock.file({
mode: 0755
})
})
})
'use strict';
require('../lib/chalk').set();
require('../lib/worker/options').set({});
const proxyquire = require('proxyquire').noPreserveCache();
const {test} = require('tap');
const Runner = require('../lib/runner');
const beautifyStack = proxyquire('../lib/beautify-stack', {
debug() {
return {
enabled: false
};
}
});
function fooFunc() {
barFunc();
}
function barFunc() {
'use strict';
const assert = require('assert');
const sinon = require('sinon');
const proxyquire = require('proxyquire').noPreserveCache();
describe('Transform', () => {
let Transform;
let transformInstance;
class MockSerializer {
constructor(node, options) {
this.node = node;
this.options = options;
}
serialize() {}
}
let mockSerializer = sinon.spy(function() {
return sinon.createStubInstance(MockSerializer);
});
var proxyquire = require('proxyquire').noPreserveCache(),
Q = require('q'),
_ = require('underscore'),
Queries = require('../lib/commands/queries'),
Utils = require('../lib/commands/utils'),
Invoker = require('../lib/commands').Invoker,
EventEmitter = require('events');
describe('Invoker', () => {
var readline, exit, invoker, db, messages, writer, request;
function mockCommands(invoker, mocks, db, names) {
names.forEach(name => {
var CommandType = proxyquire('../lib/commands/' + name, mocks);
var command = new CommandType(db);
invoker.commands = _.map(invoker.commands, cmd => {
return (cmd.constructor.name == command.constructor.name) ? command : cmd;
'use strict';
var proxyquire = require('proxyquire').noPreserveCache();
var stockCtrlStub = {
index: 'stockCtrl.index',
show: 'stockCtrl.show',
create: 'stockCtrl.create',
update: 'stockCtrl.update',
destroy: 'stockCtrl.destroy'
};
var routerStub = {
get: sinon.spy(),
put: sinon.spy(),
patch: sinon.spy(),
post: sinon.spy(),
delete: sinon.spy()
};
'use strict';
var proxyquire = require('proxyquire').noPreserveCache();
var userCtrlStub = {
index: 'userCtrl.index',
destroy: 'userCtrl.destroy',
me: 'userCtrl.me',
changePassword: 'userCtrl.changePassword',
show: 'userCtrl.show',
create: 'userCtrl.create'
};
var authServiceStub = {
isAuthenticated() {
return 'authService.isAuthenticated';
},
hasRole(role) {
return 'authService.hasRole.' + role;