Files
threshold-ui/addons/api/mirage/factories/auth-method.js
T
Susmitha Girumala db3744246b refactor: Use mirage created user in auth payload
Using mirage created user in auth payload allows for sessions for
authenticated user to be created.
2021-01-08 11:38:17 -05:00

21 lines
548 B
JavaScript

import factory from '../generated/factories/auth-method';
import { trait } from 'ember-cli-mirage';
export default factory.extend({
id: (i) => `auth-method-id-${i}`,
/**
* Adds accounts (with associated users) to auth method.
*/
withAccountsAndUsers: trait({
afterCreate(authMethod, server) {
const { scope } = authMethod;
server.createList('user', 5, { scope }).map(user => {
const { id } = server.create('account', { scope, authMethod });
user.update({ accountIds: [id] });
});
}
})
});