Skip to content

Commit 17b3a0b

Browse files
committed
Auto merge of #2129 - Turbo87:factories, r=locks
mirage: Add `team` and `user` factories This is roughly similar to #2128, but for the `team` and `user` resources. r? @locks
2 parents 7e24ded + b359dae commit 17b3a0b

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

mirage/factories/team.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Factory } from 'ember-cli-mirage';
2+
3+
const ORGS = ['rust-lang', 'emberjs', 'rust-random', 'georust', 'actix'];
4+
5+
export default Factory.extend({
6+
name: i => `team-${i + 1}`,
7+
8+
login(i) {
9+
return `github:${ORGS[i % ORGS.length]}:${this.name}`;
10+
},
11+
12+
url(i) {
13+
return `https://github.com/${ORGS[i % ORGS.length]}`;
14+
},
15+
16+
avatar: 'https://avatars1.githubusercontent.com/u/14631425?v=4',
17+
});

mirage/factories/user.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Factory } from 'ember-cli-mirage';
2+
import { dasherize } from '@ember/string';
3+
4+
export default Factory.extend({
5+
name: i => `User ${i + 1}`,
6+
7+
login() {
8+
return dasherize(this.name);
9+
},
10+
11+
url() {
12+
return `https://github.com/${this.login}`;
13+
},
14+
15+
avatar: 'https://avatars1.githubusercontent.com/u/14631425?v=4',
16+
});

0 commit comments

Comments
 (0)