• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ember-cli-mirage.Factory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ember-cli-mirage.faker.date类代码示例发布时间:2022-05-25
下一篇:
TypeScript qunit.withChai函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap