當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript deep-freeze.default函數代碼示例

本文整理匯總了TypeScript中deep-freeze.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了default函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it("should return a new instance with the correct state", () => {
     let initialState: Array<Wine> = [new Wine(), new Wine(), new Wine()];
     initialState[0]._id = "fakeid1";
     initialState[1]._id = "fakeid2";
     initialState[2]._id = "fakeid3";
     deepfreeze(initialState);
     let changedState: Array<Wine> = winesReducer(initialState, {
         type: DATA_WINES_REMOVE,
         payload: {_id: initialState[0]._id}
     });
     expect(changedState).not.toBe(initialState);
     expect(changedState.length).toBe(2);
     expect(_.filter(changedState, (wine: Wine) => wine._id === initialState[0]._id).length).toBe(0)
 });
開發者ID:kurtdevocht,項目名稱:winecellar,代碼行數:14,代碼來源:winesReducer.spec.ts

示例2: it

 it("should return the same state", () => {
     let initialState: AuthenticationDataState = {
         isAuthenticated: true,
         jwtToken: "token",
         account: {
             firstName: "firstName",
             lastName: "lastName",
             login: "login"
         }
     };
     deepfreeze(initialState);
     let changedState: AuthenticationDataState = authenticationReducer(initialState, {type: null});
     expect(changedState).toBe(initialState);
 });
開發者ID:appcoreopc,項目名稱:winecellar,代碼行數:14,代碼來源:authenticationReducer.spec.ts

示例3: UpdateRate

 it("should return a new instance with the correct state", () => {
     let initialState: Array<Wine> = [new Wine(), new Wine(), new Wine()];
     initialState[0]._id = "fakeid1";
     initialState[1]._id = "fakeid2";
     initialState[2]._id = "fakeid3";
     let newRating: number = 5;
     deepfreeze(initialState);
     let changedState: Array<Wine> = winesReducer(initialState,
         new UpdateRate("fakeid1", newRating)
     );
     expect(changedState).not.toBe(initialState);
     expect(changedState[0]).not.toBe(initialState[0]);
     expect(changedState[0].myRating).toBe(newRating);
 });
開發者ID:brechtbilliet,項目名稱:winecellar,代碼行數:14,代碼來源:wines.reducer.spec.ts

示例4: it

 it("should return a new instance with the correct state", () => {
     let initialState: Array<Wine> = [new Wine(), new Wine(), new Wine()];
     initialState[0]._id = "fakeid1";
     initialState[1]._id = "fakeid2";
     initialState[2]._id = "fakeid3";
     let newInStock: number = 5;
     deepfreeze(initialState);
     let changedState: Array<Wine> = winesReducer(initialState, {
         type: DATA_WINES_UPDATE_STOCK,
         payload: {_id: initialState[0]._id, inStock: newInStock}
     });
     expect(changedState).not.toBe(initialState);
     expect(changedState[0]).not.toBe(initialState[0]);
     expect(changedState[0].inStock).toBe(newInStock);
 });
開發者ID:appcoreopc,項目名稱:winecellar,代碼行數:15,代碼來源:winesReducer.spec.ts

示例5: it

 it("should return a new instance with the correct state", () => {
     let initialState: AuthenticationDataState = {
         isAuthenticated: false,
         jwtToken: "",
         account: null
     };
     let payload: any = {token: "token", firstName: "firstname", lastName: "lastname", login: "login"};
     deepfreeze(initialState);
     let changedState: AuthenticationDataState =
         authenticationReducer(initialState, new SetAuthentication(payload));
     expect(changedState).not.toBe(initialState);
     expect(changedState.jwtToken).toEqual(payload.token);
     expect(changedState.account.firstName).toEqual(payload.firstName);
     expect(changedState.account.lastName).toEqual(payload.lastName);
     expect(changedState.account.login).toEqual(payload.login);
 });
開發者ID:brechtbilliet,項目名稱:winecellar,代碼行數:16,代碼來源:authentication.reducer.spec.ts

示例6: it

        it("should unstar the tweet that was passed in the payload if it was false", () => {
            let tweet1: Tweet = new Tweet(1, "@KwintenP", "Giving a talk at JSBE", true);
            let tweet2: Tweet = new Tweet(3, "@JS_BE", "Giving a meetup, yeaj", true);
            let initialState: Array<Tweet> = [tweet1, tweet2];
            deepfreeze(initialState);

            let changedState: Array<Tweet> = tweetsReducer(initialState,
                {
                    type: TOGGLE_STAR_TWEET,
                    payload: {
                        id: 1
                    }
                });

            expect(changedState[0].starred).toBeFalsy();
        });
開發者ID:KwintenP,項目名稱:jsbe_talk,代碼行數:16,代碼來源:reducers.spec.ts

示例7: it

        it("should return a new state with a different isCollapsed value", () => {
            let initialState: CollapsableSidebarContainerState = {
                isCollapsed: false
            };
            deepfreeze(initialState);
            let changedState: CollapsableSidebarContainerState =
                collapsableSidebarReducer(initialState, new ToggleSidebar());
            expect(changedState).not.toBe(initialState);
            expect(changedState.isCollapsed).toBe(true);
            initialState = {
                isCollapsed: true
            };
            changedState = collapsableSidebarReducer(initialState, new ToggleSidebar());
            expect(changedState.isCollapsed).toBe(false);

        });
開發者ID:brechtbilliet,項目名稱:winecellar,代碼行數:16,代碼來源:collapsable-sidebar.reducer.spec.ts

示例8: it

 it("should return a new instance with the state cleared", () => {
     let initialState: AuthenticationDataState = {
         isAuthenticated: true,
         jwtToken: "token",
         account: {
             firstName: "firstName",
             lastName: "lastName",
             login: "login"
         }
     };
     deepfreeze(initialState);
     let changedState: AuthenticationDataState =
         authenticationReducer(initialState, {type: DATA_AUTHENTICATION_CLEAR_AUTHENTICATION});
     expect(changedState).not.toBe(initialState);
     expect(changedState.isAuthenticated).toBe(false);
 });
開發者ID:kurtdevocht,項目名稱:winecellar,代碼行數:16,代碼來源:authenticationReducer.spec.ts

示例9: it

        it("should return a new state with a different isCollapsed value", () => {
            let initialState: CollapsableSidebarContainerState = {
                isCollapsed: false
            };
            deepfreeze(initialState);
            let changedState: CollapsableSidebarContainerState =
                collapsableSidebarReducer(initialState, {type: CONTAINER_COLLAPSABLESIDEBAR_TOGGLE});
            expect(changedState).not.toBe(initialState);
            expect(changedState.isCollapsed).toBe(true);
            initialState = {
                isCollapsed: true
            };
            changedState = collapsableSidebarReducer(initialState, {type: CONTAINER_COLLAPSABLESIDEBAR_TOGGLE});
            expect(changedState.isCollapsed).toBe(false);

        });
開發者ID:kurtdevocht,項目名稱:winecellar,代碼行數:16,代碼來源:collapsableSidebarReducer.spec.ts

示例10: UpdateWine

 it("should return a new instance with the correct state", () => {
     let initialState: Array<Wine> = [new Wine(), new Wine(), new Wine()];
     initialState[0]._id = "fakeid1";
     initialState[1]._id = "fakeid2";
     initialState[2]._id = "fakeid3";
     let updateWine: Wine = Object.assign({}, initialState[0], {
         name: "updated"
     });
     deepfreeze(initialState);
     let changedState: Array<Wine> = winesReducer(initialState,
         new UpdateWine("fakeid1", updateWine)
     );
     expect(changedState).not.toBe(initialState);
     expect(changedState[0]).not.toBe(initialState[0]);
     expect(changedState[0]).not.toBe(updateWine);
     expect(changedState[0]).toEqual(updateWine);
 });
開發者ID:brechtbilliet,項目名稱:winecellar,代碼行數:17,代碼來源:wines.reducer.spec.ts


注:本文中的deep-freeze.default函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。