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';
export default Factory.extend({
createdAt: faker.date.past(1), // some time in the past 1 year
description: faker.company.bs
});
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';
const MATERIAL_UI_COLORS = ['#F44336', '#E91E63', '#9C27B0', '#009688', '#2196F3', '#4CAF50', '#FFC107', '#FF5722', '#607D8B'];
export default Mirage.Factory.extend({
firstName: faker.name.firstName,
lastName: faker.name.firstName,
company: faker.company.companyName,
address: faker.address.streetAddress,
country: faker.address.country,
state: faker.address.state,
email: faker.internet.email,
username: faker.internet.userName,
avatar: faker.internet.avatar,
bio: faker.lorem.paragraph,
color: () => faker.random.arrayElement(MATERIAL_UI_COLORS)
});
import Mirage, {faker} from 'ember-cli-mirage';
export default Mirage.Factory.extend({
name: faker.company.companyName,
office: function(i) {
let id = i + 1;
return id;
},
});
import { Factory, faker, trait } from 'ember-cli-mirage';
import { provide } from '../utils';
import { DATACENTERS, HOSTS, generateResources } from '../common';
import moment from 'moment';
const UUIDS = provide(100, faker.random.uuid.bind(faker.random));
const NODE_STATUSES = ['initializing', 'ready', 'down'];
const NODE_CLASSES = provide(7, faker.company.bsBuzz.bind(faker.company));
const REF_DATE = new Date();
export default Factory.extend({
id: i => (i / 100 >= 1 ? `${UUIDS[i]}-${i}` : UUIDS[i]),
name: i => `nomad@${HOSTS[i % HOSTS.length]}`,
datacenter: faker.list.random(...DATACENTERS),
nodeClass: faker.list.random(...NODE_CLASSES),
drain: faker.random.boolean,
status: faker.list.random(...NODE_STATUSES),
tls_enabled: faker.random.boolean,
schedulingEligibility: () => (faker.random.boolean() ? 'eligible' : 'ineligible'),
createIndex: i => i,
modifyIndex: () => faker.random.number({ min: 10, max: 2000 }),
title() {
return capitalize(faker.random.arrayElement([
faker.company.bs,
faker.company.catchPhrase,
faker.hacker.noun,
faker.lorem.word,
])());
},
collection: false,
siteName() { return faker.company.companyName(); },
logo() { return faker.image.business(); }
title: function() {
return faker.company.catchPhraseAdjective() + " " + faker.company.catchPhraseNoun();
},
});