本文整理汇总了TypeScript中ember-cli-mirage.faker.random类的典型用法代码示例。如果您正苦于以下问题:TypeScript faker.random类的具体用法?TypeScript faker.random怎么用?TypeScript faker.random使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了faker.random类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
properties: () => ({
DB_ID: faker.random.number({ min: 10000, max: 20000 }),
TBL_ID: faker.random.number({ min: 10000, max: 20000 }),
view_depends_on: [faker.commerce.productName()],
create_time: faker.date.past(),
etl_source: 'COLUMN_V2',
input_format: faker.commerce.productName(),
output_format: faker.commerce.productName(),
is_compressed: false,
SD_ID: faker.random.number({ min: 10000, max: 20000 }),
is_storedassubdirectories: false,
serialization_format: 'Sequence',
tbl_type: 'VIRTUAL_VIEW',
view_expanded_text: faker.lorem.sentence()
}),
示例2: id
import { Factory, faker, trait } from 'ember-cli-mirage';
import { IHealthScoreObject } from 'wherehows-web/typings/api/datasets/health';
const tierOptions = ['CRITICAL', 'WARNING', 'MINOR'];
export default Factory.extend({
id(id: number) {
return id;
},
score: faker.random.number({ min: 0, max: 100 }),
validations() {
const numValidations = faker.random.number({ min: 1, max: 6 });
const validations: Array<IHealthScoreObject> = [];
for (let i = 0; i < numValidations; i++) {
const validation: IHealthScoreObject = {
tier: tierOptions[i % 3],
score: faker.random.number({ min: 0, max: 100 }) / 100,
description: faker.lorem.sentences(),
weight: faker.random.number({ min: 0, max: 100 }) / 100,
validator: 'fake'
};
validations.push(validation);
}
return validations;
},
forTesting: trait({
score: 83,
示例3: uri
import { Factory, faker } from 'ember-cli-mirage';
import { DatasetPlatform } from 'wherehows-web/constants';
import { hdfsUrn, nonHdfsUrn } from 'wherehows-web/mirage/fixtures/urn';
export default Factory.extend({
createdTime: faker.date.past(2),
deprecated: true,
deprecationNote: faker.lorem.words(5),
description: faker.lorem.words(7),
fabric: null,
modifiedTime: faker.date.recent(),
nativeName: 'abook.default-public-container',
nativeType: null,
platform: faker.list.random(...Object.values(DatasetPlatform)),
properties: '{}',
removed: faker.random.boolean(),
tags: null,
uri() {
const { platform } = this;
return platform === DatasetPlatform.HDFS
? hdfsUrn
: nonHdfsUrn.replace(/li:dataPlatform:db/, `li:dataPlatform:${platform}`);
}
});
示例4: userName
import { Factory, faker } from 'ember-cli-mirage';
export default Factory.extend({
userName() {
return faker.internet.userName();
},
departmentNum() {
return 0;
},
email() {
return faker.internet.email();
},
name() {
return faker.name.firstName() + ' ' + faker.name.lastName();
},
userSetting() {
return null;
},
flowId() {
return faker.random.number({ min: 1, max: 10 });
}
});
示例5: count
import { Factory, faker } from 'ember-cli-mirage';
export default Factory.extend({
count() {
return faker.random.number({ min: 0, max: 10000 });
}
});