UNPKG

767 BJavaScriptView Raw
1/**
2 * Copyright 2014, Yahoo! Inc.
3 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
4 */
5'use strict';
6
7var dispatchr = require('dispatchr');
8var MockActionContextClass = require('./MockActionContext');
9
10module.exports = function createMockActionContext(options) {
11 options = options || {};
12 options.mockActionContextClass = options.mockActionContextClass || MockActionContextClass;
13 options.stores = options.stores || [];
14 options.dispatcher = options.dispatcher || dispatchr.createDispatcher({
15 stores: options.stores
16 });
17 options.dispatcherContext = options.dispatcherContext || options.dispatcher.createContext();
18
19 return new options.mockActionContextClass(options.dispatcherContext);
20};