-
Notifications
You must be signed in to change notification settings - Fork 38
/
file.js
49 lines (45 loc) · 1.48 KB
/
file.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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: {
upload: '/this/is/an/upload/url',
download: '/this/is/a/download/url',
move: '/this/is/a/move/url',
delete: '/this/is/a/delete/url',
new_folder: '/this/is/a/new_folder/url'
}
},
traits: {
// Folder specific
isFolder: {
kind: 'folder',
materializedPath: () => '/' + faker.lorem.words(1),
files: () => FactoryGuy.hasMany('file', 3)
},
// File specific
hasVersions: {
kind: 'file',
versions: () => FactoryGuy.hasMany('file-version', 3)
},
hasComments: {
kind: 'file',
comments: () => FactoryGuy.hasMany('comment', 3)
},
hasTags: {
kind: 'file',
tags: () => [faker.lorem.words(1), faker.lorem.words(1), faker.lorem.words(1)]
}
}
});