Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Mirage, {faker} from 'ember-cli-mirage';
export default Mirage.Factory.extend({
firstName: faker.name.firstName, // using faker
lastName: faker.name.lastName,
email: function(i) { // and functions
return 'person' + i + '@email.com';
},
when: faker.date.future,
quantity: faker.random.number,
avatar: faker.image.avatar,
topic: faker.lorem.words,
status: faker.list.random('downloaded','verifying','verified','scheduling','scheduled','preparing','executing','executed')
});
import { Factory, faker } from 'ember-cli-mirage';
import Ember from 'ember';
const { String } = Ember;
export default Factory.extend({
closedTasksCount: 0,
description: faker.lorem.sentence,
iconLargeUrl: faker.image.imageUrl,
iconThumbUrl: faker.image.imageUrl,
openTasksCount: 0,
title: faker.name.title,
website: faker.url,
slug() {
if (this.title) {
return String.underscore(this.title.toLowerCase());
}
},
// ensures associations exist if they haven't been provided
afterCreate(project, server) {
if (!project.organization) {
project.organization = server.create('organization');
project.save();
}
}
});
/*
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)
});
name() {
return faker.name.jobArea();
},
});
authorName() {
return faker.name.findName();
},
downloadCount() {
unregisteredContributor() {
return faker.random.number(5) ? undefined : faker.name.firstName();
},
index(i: number) {
middleNames() {
return `${faker.name.firstName()} ${faker.name.firstName()}`;
},
familyName() {
name() {
return faker.name.firstName() + ' ' + faker.name.lastName();
},
userSetting() {
suffix() {
return faker.name.suffix();
},
locale() {
userFullName() {
return `${faker.name.firstName()} ${faker.name.lastName()}`;
},
department() {