How to use the ember-data-factory-guy.define 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 / file.ts View on Github external
import FactoryGuy from 'ember-data-factory-guy';
import faker from 'faker';

FactoryGuy.define('file', {
    default: {
        name: () => `${faker.lorem.words(1)}.txt`,
        kind: 'file',
        path: '/1234567890', // Faker.system.filePath may not yet be implemented
        size: () => faker.random.number(),
        provider: 'osfstorage',
        materializedPath: () => `/${faker.lorem.words(1)}.png`,
        lastTouched: null,

        dateModified: () => faker.date.recent(1),
        dateCreated: () => faker.date.past(1),

        isProvider: false,
        checkout: null,

        links: {
github CenterForOpenScience / ember-osf / test-support / factories / file-version.js View on Github external
import FactoryGuy from 'ember-data-factory-guy';
import faker from 'faker';

FactoryGuy.define('file-version', {
    default: {
        size: () => faker.random.number(),
        contentType: 'text/plain', // faker.system may not come with older versions of lib
    }
});
github CenterForOpenScience / ember-osf / test-support / factories / file.js View on Github external
import FactoryGuy from 'ember-data-factory-guy';
import faker from 'faker';

FactoryGuy.define('file', {
    default: {
        name: () => faker.lorem.words(1) + '.txt',
        kind: 'file',
        path: '/1234567890',  // Faker.system.filePath may not yet be implemented
        size: () => faker.random.number(),
        provider: 'osfstorage',
        materializedPath: () => '/' + faker.lorem.words(1) + '.png',
        lastTouched: null,

        dateModified: () => faker.date.recent(1),
        dateCreated: () => faker.date.past(1),

        isProvider: false,
        checkout: null,

        links: {
github CenterForOpenScience / ember-osf / test-support / factories / file-provider.js View on Github external
import FactoryGuy from 'ember-data-factory-guy';

FactoryGuy.define('file-provider', {
    default: {
        name: 'osfstorage',
        kind: 'folder',
        path: '/',
        provider: 'osfstorage',
        node: FactoryGuy.belongsTo('node')
    },
    traits: {
        hasFiles: {
            files: () => FactoryGuy.hasMany('file', 3)
        }
    }
});
github linxmix / linx / tests / factories / mix-clip.js View on Github external
import FactoryGuy from 'ember-data-factory-guy';

FactoryGuy.define('mix-clip', {
  default: {
  },
});
github linxmix / linx / tests / factories / echonest / track.js View on Github external
import FactoryGuy from 'ember-data-factory-guy';

FactoryGuy.define('echonest/track', {
  default: {},
  'echonest/track-giveitupforlove': {
    "status": "pending",
    "artist": "EDX, John Williams",
    "title": "Give It Up for Love feat. John Williams (Mysto & Pizzi Remix)",
    "analyzer_version": "3.2.2",
    "audio_summary": {
      "time_signature": 4,
      "tempo": 127.961,
      "energy": 0.8598686482238894,
      "liveness": 0.27259638737145886,
      "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRAWOGC14E8320817F/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1438821667&Signature=YBvry9SxwI8im4c5JlMRv57E4WE%3D",
      "speechiness": 0.0898701891797693,
      "mode": 0,
      "acousticness": 0.03839232695391064,
      "danceability": 0.5554706885700197,
github CenterForOpenScience / ember-osf-web / tests / factories / preprint.ts View on Github external
import FactoryGuy from 'ember-data-factory-guy';
import faker from 'faker';

FactoryGuy.define('preprint', {
    default: {
        dateCreated: () => faker.date.past(2),
        datePublished: () => faker.date.past(1),
        dateModified: () => faker.date.recent(),
        doi: () => `10.1000/${String(faker.random.number())}`,
        node: FactoryGuy.belongsTo('node'),
        license: FactoryGuy.belongsTo('license'),
        primaryFile: FactoryGuy.belongsTo('file'),
        provider: FactoryGuy.belongsTo('preprint-provider'),
        isPublished: false,
        isPreprintOrphan: false,
    },
    traits: {
        hasBeenPublished: {
            isPublished: true,
        },
github ciena-frost / ember-frost-list / tests / factories / list-item.js View on Github external
import FactoryGuy from 'ember-data-factory-guy'

FactoryGuy.define('list-item', {
  sequences: {
    label: (num) => {
      let items = [
        'foo',
        'bar',
        'biz',
        'baz'
      ]
      return items[num % items.length]
    },
    itemType: (num) => {
      let items = [
        'a',
        'b',
        'c',
        'd'
github CenterForOpenScience / ember-osf-web / tests / factories / comment-report.ts View on Github external
import FactoryGuy from 'ember-data-factory-guy';
import faker from 'faker';

FactoryGuy.define('comment-report', {
    default: {
        category: () => faker.random.arrayElement(['hate', 'spam', 'violence']),
        text: FactoryGuy.belongsTo('comment'),
    },
});