角4茉莉花模拟常数

时间:2017-09-19 20:37:34

标签: angular jasmine

是否可以在angualr 4茉莉花中模拟常数。我有一个我正在测试的功能,并且在其中使用了一个常量。我想模拟它并为每个测试场景提供它的值。

    export function reducer(state: State = initialState, action: navigation.Actions): State {
        switch (action.type) {

            case navigation.GET_LINKS_COMPLETE: {

               // NavigationLinkConstants is what I want to mock 

                const filteredLinks: Navigation[] = _.filter(NavigationLinkConstants, (link) => {
                    // body of function goes here

                });

                return Object.assign({}, state, {
                    links: filteredLinks
                });
            }

            default: {
                return state;
            }
        }
    } 

0 个答案:

没有答案