Files
threshold-ui/ui/core/mirage/factories/auth-method.js
T

20 lines
548 B
JavaScript
Raw Normal View History

2020-06-18 15:51:40 -04:00
import factory from '../generated/factories/auth-method';
2020-09-14 11:26:54 -04:00
import { trait } from 'ember-cli-mirage';
2020-06-18 15:51:40 -04:00
2020-09-14 11:26:54 -04:00
export default factory.extend({
2020-09-14 12:00:21 -04:00
id: (i) => `auth-method-id-${i}`,
2020-09-14 11:26:54 -04:00
/**
2020-09-30 10:45:39 -04:00
* Adds accounts (with associated users) to auth method.
2020-09-14 11:26:54 -04:00
*/
2020-09-30 10:45:39 -04:00
withAccountsAndUsers: trait({
2020-09-14 11:26:54 -04:00
afterCreate(authMethod, server) {
const { scope } = authMethod;
2020-09-30 10:45:39 -04:00
server.createList('user', 5, { scope }).map(user => {
const { id } = server.create('account', { scope, authMethod });
user.update({ accountIds: [id] });
});
2020-09-14 11:26:54 -04:00
}
})
});