Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Factory } from 'ember-cli-mirage';
import faker from 'nomad-ui/mirage/faker';
import { STORAGE_PROVIDERS } from '../common';
export default Factory.extend({
id: () => faker.random.uuid(),
// Topologies is currently unused by the UI. This should
// eventually become dynamic.
topologies: () => [{ foo: 'bar' }],
provider: faker.helpers.randomize(STORAGE_PROVIDERS),
version: '1.0.1',
controllerRequired: faker.random.boolean,
controllersHealthy() {
if (!this.controllerRequired) return 0;
return faker.random.number(3);
},
controllersExpected() {
import { Factory } from 'ember-cli-mirage';
export default Factory.extend({
login: function(i) {
return `member${i}`;
},
type: 'github-member',
avatar_url: function(i) {
return `member${i}-avatar.gif`;
},
gravatar_id: '',
site_admin: false,
url: function(i) {
return `https://api.github.com/users/member${i}`;
}
});
import { Factory } from 'ember-cli-mirage';
export default Factory.extend({
description: (i) => `session description ${i}`,
});
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() {
import { Factory, faker } from 'ember-cli-mirage';
export default Factory.extend({
githubId(i) {
return `github-issue-${i}`;
},
number(i) {
return `${i + 3000}`;
},
org: () => faker.random.arrayElement(['ember-cli', 'emberjs', 'ember-learn']),
repo: () => faker.random.arrayElement(['ember.js', 'guides', 'ember-cli', 'data']),
state: () => faker.random.arrayElement(['open', 'closed']),
title: faker.hacker.phrase,
createdAt: faker.date.recent,
updatedAt: faker.date.recent
});
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 = [];
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'
};
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
const { idIds, nonIdIds } = Object.keys(fieldIdentifierTypes).reduce(
({ idIds, nonIdIds }, fieldIdTypeKey) => {
const fieldIdentifier = fieldIdentifierTypes[fieldIdTypeKey].value;
if (fieldIdentifierTypes[fieldIdTypeKey].isId) {
idIds = [...idIds, fieldIdentifier];
} else {
nonIdIds = [...nonIdIds, fieldIdentifier];
}
return { idIds, nonIdIds };
},
{ idIds: [], nonIdIds: [] }
);
export default Factory.extend({
fieldName: "address[type='com.linkedin.common.MultiLocaleString']",
identifierTypePrediction: {
value: (i) => {
const fieldIdentifierIsId = i % 2;
return faker.list.random(...(fieldIdentifierIsId ? idIds : nonIdIds))();
},
confidence: Math.random()
},
logicalTypePrediction: {
value: (i) => {
const fieldIdentifierIsId = i % 2;
const idArray = [...idLogicalTypes, ...customIdLogicalTypes];
return faker.list.random(...(fieldIdentifierIsId ? idArray : Object.keys(nonIdFieldLogicalTypes)))();
},