( context: ImpureGraphContext<false, true>, shortNamePrefix: string, logger: Logger, )
| 101 | `${prefix ?? ""}${randomStringSuffix()}`; |
| 102 | |
| 103 | export const createTestUser = async ( |
| 104 | context: ImpureGraphContext<false, true>, |
| 105 | shortNamePrefix: string, |
| 106 | logger: Logger, |
| 107 | ) => { |
| 108 | const shortname = generateRandomShortname(shortNamePrefix); |
| 109 | |
| 110 | const identity = await createKratosIdentity({ |
| 111 | traits: { |
| 112 | emails: [`${shortname}@example.com`], |
| 113 | }, |
| 114 | verifyEmails: true, |
| 115 | }).catch((err) => { |
| 116 | logger.error( |
| 117 | `Error when creating Kratos Identity, ${shortname}: ${ |
| 118 | (err as Error).message |
| 119 | }`, |
| 120 | ); |
| 121 | throw err; |
| 122 | }); |
| 123 | |
| 124 | const kratosIdentityId = identity.id; |
| 125 | |
| 126 | return createUser( |
| 127 | context, |
| 128 | { actorId: systemAccountId }, |
| 129 | { |
| 130 | emails: [`${shortname}@example.com`], |
| 131 | kratosIdentityId, |
| 132 | shortname, |
| 133 | displayName: shortname, |
| 134 | }, |
| 135 | ).catch((err) => { |
| 136 | logger.error(`Error making UserModel for ${shortname}`); |
| 137 | throw err; |
| 138 | }); |
| 139 | }; |
| 140 | |
| 141 | export const createTestOrg = async ( |
| 142 | context: ImpureGraphContext<false, true>, |
no test coverage detected