本文整理汇总了TypeScript中faker.random.uuid方法的典型用法代码示例。如果您正苦于以下问题:TypeScript random.uuid方法的具体用法?TypeScript random.uuid怎么用?TypeScript random.uuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类faker.random
的用法示例。
在下文中一共展示了random.uuid方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should contain a list of panels after the data is loaded', () => {
const panels: PanelListItem[] = [
{
id: faker.random.uuid(),
title: faker.random.words(),
startDate: faker.date.recent(),
endDate: faker.date.future()
},
{
id: faker.random.uuid(),
title: faker.random.words(),
startDate: faker.date.recent(),
endDate: faker.date.future()
},
{
id: faker.random.uuid(),
title: faker.random.words(),
startDate: faker.date.recent(),
endDate: faker.date.future()
}
];
const action = new PanelActions.LoadPanelsSuccess(panels);
store.dispatch(action);
component.panels$.subscribe(data => {
expect(data.length).toBe(panels.length);
});
});
示例2:
const createChannel = () => {
return {
id: faker.random.uuid(),
name: faker.random.word(),
direct: faker.random.boolean(),
unseenMessages: faker.random.boolean() ? faker.random.number(30) : 0
};
};
示例3: test
test('vaild id', () => {
const config: any = {
id: random.alphaNumeric(10),
host: random.alphaNumeric(15),
ignore: random.alphaNumeric(15)
}
inject(elementId, `a${random.uuid()}`, config) // The attribute key must start with an alphabet.
expect(document.getElementById(elementId))
})
示例4: describe
describe('injector', () => {
const elementId = random.uuid()
test('vaild id', () => {
const config: any = {
id: random.alphaNumeric(10),
host: random.alphaNumeric(15),
ignore: random.alphaNumeric(15)
}
inject(elementId, `a${random.uuid()}`, config) // The attribute key must start with an alphabet.
expect(document.getElementById(elementId))
})
test('ignore domain', () => {
const config: any = {
id: random.alphaNumeric(10),
host: random.alphaNumeric(15),
ignore: 'about:blank'
}
inject(elementId, `a${random.uuid()}`, config) // L13
expect(document.getElementById(elementId))
})
})
示例5: authenticated
sendMessage: authenticated(AccountsServer, (root, { channelId, content }, {user}) => {
const messagesArray = messages.get(channelId);
if (!messagesArray) {
console.error('channel not found');
return null;
}
const newMessage = {
id: faker.random.uuid(),
content,
creationTime: (new Date()).getTime().toString(),
author: {
name: user.profile.name,
avatar: user.profile.avatar
},
channel: {
id: channelId,
}
};
messagesArray.unshift(newMessage);
pubsub.publish(CHAT_MESSAGE_SUBSCRIPTION_TOPIC, { chatMessageAdded: newMessage });
return newMessage;
}),
示例7: generateUUID
public static generateUUID() {
return faker.random.uuid();
}