Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(function () {
context = createMockActionContext({
stores: [ BackgroundStore ]
});
});
beforeEach(function () {
calledService = 0;
context = createMockActionContext({
stores: [ApplicationStore, ContentStore]
});
context.service = new MockService();
context.service.setService('page', function (method, params, config, callback) {
calledService++;
serviceData.fetch(params, callback);
});
});
beforeEach(function () {
context = createMockActionContext({
stores: [RouteStore]
});
});
beforeEach(function() {
currentRoute = Immutable.Map({
path: 'http:localhost:8000',
params: Immutable.Map({
range: '1-10',
surahId: 2
})
});
actionContext = createMockActionContext({
stores: [AyahsStore, RouteStore]
});
actionContext.getStore('AyahsStore').ayahs = getAyahs.slice(0, 10);
actionContext.getStore('RouteStore').getCurrentRoute = function() {
return currentRoute;
}
sinon.stub(actionContext, 'executeAction');
});
function createMockContext () {
context = createMockActionContext({
stores: [ApplicationStore, ContentStore]
});
context.service = new MockService();
context.service.setService('routes', function (method, params, config, callback) {
if (params.emulateError) {
return callback(mockError);
}
callback(null, fluxibleRoutes);
});
context.service.setService('page', function (method, params, config, callback) {
if (params.emulateError) {
return callback(mockError);
}
callback(null, '<h1>Hello World</h1>');
});
}
beforeEach(function () {
context = createMockActionContext({
stores: [ ContactStore ]
});
context.service = new MockService();
context.service.setService('contact', function (method, params, body, config, callback) {
serviceMail.send(params, callback);
});
});
beforeEach(function () {
context = createMockActionContext({
stores: [ BackgroundStore ]
});
});