Files
threshold-ui/ui/core/mirage/factories/group.js
T

18 lines
459 B
JavaScript
Raw Normal View History

2020-06-24 17:07:32 -04:00
import factory from '../generated/factories/group';
2020-09-01 12:03:36 -04:00
import { trait } from 'ember-cli-mirage';
2020-06-24 17:07:32 -04:00
export default factory.extend({
2020-09-01 12:03:36 -04:00
id: (i) => `group-${i}`,
/**
* Generates some users for the same scope and assigns them to the group
* as members.
*/
withMembers: trait({
afterCreate(group, server) {
const scope = group.scope;
2020-09-01 12:03:53 -04:00
const members = server.createList('user', 2, { scope });
2020-09-01 12:03:36 -04:00
group.update({ members });
}
})
});