本文整理汇总了TypeScript中ember-cli-mirage.Factory类的典型用法代码示例。如果您正苦于以下问题:TypeScript Factory类的具体用法?TypeScript Factory怎么用?TypeScript Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Factory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: purgeNote
import { Factory, faker } from 'ember-cli-mirage';
import { PurgePolicy } from 'wherehows-web/constants';
import { hdfsUrn, nonHdfsUrn } from 'wherehows-web/mirage/fixtures/urn';
export default Factory.extend({
datasetId: null,
datasetUrn: faker.list.random(hdfsUrn, nonHdfsUrn),
purgeType: faker.list.random(...Object.values(PurgePolicy)),
purgeNote() {
const { purgeType } = this;
return purgeType === PurgePolicy.PurgeExempt ? faker.lorem.words(5) : '';
},
modifiedBy: faker.internet.userName(),
modifiedTime: faker.date.past()
});
开发者ID:alyiwang,项目名称:WhereHows,代码行数:20,代码来源:retention.ts
示例2:
import { Factory, faker } from 'ember-cli-mirage';
import { DatasetPlatform, PurgePolicy } from 'wherehows-web/constants';
export default Factory.extend({
name: faker.list.random(...Object.values(DatasetPlatform)),
type: faker.lorem.words(1),
supportedPurgePolicies: Object.values(PurgePolicy)
});
开发者ID:alyiwang,项目名称:WhereHows,代码行数:10,代码来源:platform.ts
示例3: id
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,
validations() {
const validations: Array<IHealthScoreObject> = [];
for (let i = 0; i < 3; i++) {
const validation: IHealthScoreObject = {
tier: tierOptions[i],
score: 1 - (3 - i) * 0.25,
description: faker.lorem.sentences(2),
weight: faker.random.number({ min: 0, max: 100 }) / 100,
validator: 'fake'
};
validations.push(validation);
}
}
})
});
开发者ID:alyiwang,项目名称:WhereHows,代码行数:43,代码来源:health.ts
示例4: trait
export default Factory.extend({
id: faker.random.number({ min: 10000, max: 20000 }),
created: null,
formatedModified: '2017-09-04 10:34:44.0',
hasSchemaHistory: false,
hdfsBrowserLink: null,
isFavorite: false,
isOwned: false,
isWatched: false,
modified: faker.date.past(),
name: faker.commerce.productName(),
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()
}),
// TODO https://github.com/samselikoff/ember-cli-mirage/issues/1379
whSchema: 'abcd',
source: 'Hive',
urn: faker.internet.url(),
watchId: 0,
owners: () => [],
forUnitTests: trait({
id(id: number) {
return id;
},
// TODO https://github.com/samselikoff/ember-cli-mirage/issues/1379
whSchema(id: number) {
return id === 0 ? testSchemaA : 'abcd';
}
}),
// TODO https://github.com/samselikoff/ember-cli-mirage/issues/1379
afterCreate(dataset: any) {
dataset.attrs.schema = dataset.attrs.whSchema;
}
});
开发者ID:alyiwang,项目名称:WhereHows,代码行数:50,代码来源:dataset.ts
示例5: 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}`);
}
});
开发者ID:alyiwang,项目名称:WhereHows,代码行数:24,代码来源:dataset-view.ts
示例6: 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 });
}
});
开发者ID:alyiwang,项目名称:WhereHows,代码行数:22,代码来源:owner.ts
示例7: count
import { Factory, faker } from 'ember-cli-mirage';
export default Factory.extend({
count() {
return faker.random.number({ min: 0, max: 10000 });
}
});
开发者ID:alyiwang,项目名称:WhereHows,代码行数:7,代码来源:datasets-count.ts
示例8: containsUserActionGeneratedContent
import { Factory } from 'ember-cli-mirage';
const randomize = () => Math.random() < 0.5;
export default Factory.extend({
containsUserActionGeneratedContent() {
return this.randomized ? randomize() : false;
},
containsUserDerivedContent() {
return this.randomized ? randomize() : false;
},
containsUserGeneratedContent() {
return this.randomized ? randomize() : false;
}
});
开发者ID:alyiwang,项目名称:WhereHows,代码行数:17,代码来源:export-policy.ts
注:本文中的ember-cli-mirage.Factory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论