Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
traits: {
hasParent: { // Is a child of a public node
parent: () => FactoryGuy.belongsTo('node'),
},
hasChildren: { // Has one layer of child projects
children: FactoryGuy.hasMany('node', 3),
},
hasInstitution: {
affiliatedInstitutions: FactoryGuy.hasMany('institution', 1),
},
hasComments: {
comments: FactoryGuy.hasMany('comment', 3),
},
hasContributors: {
contributors: FactoryGuy.hasMany('contributor', 3),
},
hasFiles: {
files: FactoryGuy.hasMany('file-provider', 3, 'hasFiles'),
},
hasRegistrations: {
registrations: FactoryGuy.hasMany('registration', 1),
},
hasLogs: {
logs: FactoryGuy.hasMany('log', 5),
},
hasTags: {
tags: () => [faker.lorem.words(1), faker.lorem.words(1), faker.lorem.words(1)],
},
},
});
collection: false,
registration: false,
public: () => faker.random.boolean(),
dateCreated: () => faker.date.past(1),
dateModified: () => faker.date.recent(1),
},
traits: {
hasParent: { // Is a child of a public node
parent: () => FactoryGuy.belongsTo('node'),
},
hasChildren: { // Has one layer of child projects
children: FactoryGuy.hasMany('node', 3),
},
hasInstitution: {
affiliatedInstitutions: FactoryGuy.hasMany('institution', 1),
},
hasComments: {
comments: FactoryGuy.hasMany('comment', 3),
},
hasContributors: {
contributors: FactoryGuy.hasMany('contributor', 3),
},
hasFiles: {
files: FactoryGuy.hasMany('file-provider', 3, 'hasFiles'),
},
hasRegistrations: {
registrations: FactoryGuy.hasMany('registration', 1),
},
hasLogs: {
logs: FactoryGuy.hasMany('log', 5),
},
affiliatedInstitutions: () => FactoryGuy.hasMany('institution', 2),
},
comments: () => FactoryGuy.hasMany('comment', 3),
},
name: () => faker.lorem.words(1),
logoPath: () => `/static/img/preprint_providers/${faker.lorem.words(1)}.png`,
bannerPath: () => `/static/img/preprint_providers/${faker.lorem.words(1)}.png`,
description: () => faker.lorem.words(3),
advisoryBoard: () => faker.lorem.paragraphs(2),
emailContact: 'contact+fake@osf.io',
emailSupport: 'support+fake@osf.io',
headerText: () => faker.lorem.words(3),
subjects: FactoryGuy.hasMany('subject', 20),
},
traits: {
isOSF: {
id: 'osf',
},
hasPreprints: {
preprints: FactoryGuy.hasMany('preprint', 5),
},
hasLicenses: {
licensesAcceptable: FactoryGuy.hasMany('license', 3),
},
},
});
description: () => faker.lorem.words(3),
advisoryBoard: () => faker.lorem.paragraphs(2),
emailContact: 'contact+fake@osf.io',
emailSupport: 'support+fake@osf.io',
headerText: () => faker.lorem.words(3),
subjects: FactoryGuy.hasMany('subject', 20),
},
traits: {
isOSF: {
id: 'osf',
},
hasPreprints: {
preprints: FactoryGuy.hasMany('preprint', 5),
},
hasLicenses: {
licensesAcceptable: FactoryGuy.hasMany('license', 3),
},
},
});
nodes: () => FactoryGuy.hasMany('node', 3)
},
import FactoryGuy from 'ember-data-factory-guy';
import faker from 'faker';
FactoryGuy.define('collection', {
default: {
title: () => faker.lorem.words(3),
dateCreated: () => faker.date.past(1),
dateModified: () => faker.date.recent(1),
bookmarks: false
},
traits: {
hasNodes: {
linkedNodes: FactoryGuy.hasMany('node', 3)
},
hasRegistrations: {
linkedRegistrations: FactoryGuy.hasMany('registration', 3)
},
isBookmark: {
bookmarks: true
}
}
});