Skip to content

Commit b5c250a

Browse files
committed
Auto merge of #2135 - Turbo87:factories, r=locks
mirage: Add factories for `dependency` and `version-download` resources similar to #2129 r? @locks
2 parents 8561f9e + 95173c1 commit b5c250a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

mirage/factories/dependency.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Factory } from 'ember-cli-mirage';
2+
3+
const REQS = ['^0.1.0', '^2.1.3', '0.3.7', '~5.2.12'];
4+
5+
export default Factory.extend({
6+
// crate_id,
7+
// version_id,
8+
9+
default_features: i => i % 4 === 3,
10+
features: () => [],
11+
kind: i => (i % 3 === 0 ? 'dev' : 'normal'),
12+
optional: i => i % 4 !== 3,
13+
req: i => REQS[i % REQS.length],
14+
target: null,
15+
});

mirage/factories/version-download.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Factory } from 'ember-cli-mirage';
2+
3+
export default Factory.extend({
4+
// version
5+
6+
date: '2019-05-21',
7+
downloads: i => (((i * 42) % 13) + 4) * 2345,
8+
});

0 commit comments

Comments
 (0)