How to use the ember-data-factory-guy.hasMany function in ember-data-factory-guy

To help you get started, we’ve selected a few ember-data-factory-guy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CenterForOpenScience / ember-osf-web / tests / factories / node.ts View on Github external
},
    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)],
        },
    },
});
github CenterForOpenScience / ember-osf-web / tests / factories / node.ts View on Github external
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),
        },
github CenterForOpenScience / ember-osf-web / tests / factories / user.ts View on Github external
            affiliatedInstitutions: () => FactoryGuy.hasMany('institution', 2),
        },
github CenterForOpenScience / ember-osf-web / tests / factories / preprint-provider.ts View on Github external
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),
        },
    },
});
github CenterForOpenScience / ember-osf-web / tests / factories / preprint-provider.ts View on Github external
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),
        },
    },
});
github CenterForOpenScience / ember-osf / test-support / factories / collection.js View on Github external
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
        }
    }
});