!(function () {
    Report = {
        SessionMgr: {
            get() {
                return '';
            },
        },
    };
    let target = null;
    const targetStack = [];

    function pushTarget (_target) {
        if (target) {
            targetStack.push(target);
        }
        Fix.Model.target = target = _target;
    }

    function popTarget () {
        Fix.Model.target = target = targetStack.pop();
    }

    Fix.Test = {
        makeContext: (state, fn) => {
            const Store = BI.inherit(Fix.Model, {
                state,
                childContext: Object.keys(state),
            });
            const store = new Store();
            pushTarget(store);
            fn(store);
            popTarget();

            return store;
        },
        extractContext: (model, contextList) => {
            BI.each(BI.deepClone(model), key => {
                if (BI.contains(contextList, key)) {
                    return;
                }

                delete model[key];
            });

            return model;
        },
    };
}());