本文整理匯總了TypeScript中models/users/spec/fixtures.usersJSON函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript usersJSON函數的具體用法?TypeScript usersJSON怎麽用?TypeScript usersJSON使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了usersJSON函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should remove user by username", () => {
const users = Users.fromJSON(usersJSON());
const user = Users.fromJSON(usersJSON())[2];
user.displayName("Testing replace");
const originalUser = users[2];
users.replace(user);
// not the same object
expect(originalUser).not.toEqual(users[2]);
expect(user).toEqual(users[2]);
});
示例2: it
it("should deserialize User JSON", () => {
const users = Users.fromJSON(usersJSON());
expect(users).toHaveLength(7);
const rootUser = users[0];
const rootUserJSON = usersJSON()._embedded.users[0];
expect(rootUser.loginName()).toEqual(rootUserJSON.login_name);
expect(rootUser.displayName()).toEqual(rootUserJSON.display_name as string);
expect(rootUser.enabled()).toEqual(rootUserJSON.enabled as boolean);
expect(rootUser.email()).toEqual(rootUserJSON.email as string);
expect(rootUser.emailMe()).toEqual(rootUserJSON.email_me as boolean);
expect(rootUser.checkinAliases()).toEqual(rootUserJSON.checkin_aliases as string[]);
});
示例3: it
it("should return all users when no search query is provided", () => {
const users = Users.fromJSON(usersJSON());
const userFilters = new UserFilters();
const filteredUsers = userFilters.performFilteringOn(users);
expect(filteredUsers.totalUsersCount()).toBe(7);
expect(userFilters.searchText()).toBe("");
});