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, faker } from 'ember-cli-mirage';
import Collection from 'ember-osf-web/models/collection';
import { guid, guidAfterCreate } from './utils';
export default Factory.extend({
id: guid('collection'),
afterCreate: guidAfterCreate,
title: faker.lorem.sentence(),
dateCreated: faker.date.past(2),
dateModified: faker.date.past(2),
bookmarks: faker.random.boolean(),
});
declare module 'ember-cli-mirage/types/registries/schema' {
export default interface MirageSchemaRegistry {
collections: Collection;
} // eslint-disable-line semi
}
import Mirage, { faker } from 'ember-cli-mirage';
export default Mirage.Factory.extend({
name: faker.company.bsNoun(),
zip_code: '123456',
email: faker.internet.email(),
is_created: true,
expired_at: faker.date.past(),
color: faker.internet.color(),
description: faker.lorem.sentences(10),
avatar_ids: function() {
return [1, 2];
},
});
/*
This is an example factory definition.
Create more files in this directory to define additional factories.
*/
import Mirage, { faker } from 'ember-cli-mirage';
faker.locale = 'en_US';
export default Mirage.Factory.extend({
title: faker.lorem.sentence,
isCompleted: false
});
title(i) {
return `Post #${i}: ${faker.lorem.words()}`;
},
});
tags() {
return faker.lorem.words(5).split(' ');
},
size() {
content() {
return faker.lorem.sentences(faker.random.number({ min: 1, max: 4 }));
},
dateCreated() {
validations() {
const validations: Array = [];
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);
}
}
})
synopsis() { return faker.lorem.paragraphs(); },
titles: {
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}`);
}
});
import { Factory, faker } from 'ember-cli-mirage';
import { randomGravatar } from 'ember-osf-web/mirage/utils';
import CollectionProvider from 'ember-osf-web/models/collection-provider';
import { guid, guidAfterCreate } from './utils';
export default Factory.extend({
id: guid('collection-provider'),
afterCreate: guidAfterCreate,
advisoryBoard: faker.lorem.paragraph,
emailSupport: '',
name: faker.lorem.word,
domain: faker.internet.domainName,
allowCommenting: false,
assets: {
square_color_no_transparent: randomGravatar(100),
},
facebookAppId: '',
footerLinks: '',
allowSubmissions: true,
example: '',
domainRedirectEnabled: false,
description: faker.lorem.paragraph,
});