本文整理汇总了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;未经允许,请勿转载。 |
请发表评论