MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / step1_createInvite

Function step1_createInvite

apps/web/__tests__/invites.test.ts:194–237  ·  view source on GitHub ↗
(store: storeType)

Source from the content-addressed store, hash-verified

192});
193
194async function step1_createInvite(store: storeType) {
195 let mockEmail: any;
196 mailerSendMock.mockImplementationOnce((opts) => {
197 mockEmail = opts;
198 return Promise.resolve({} as any);
199 });
200
201 await testApiHandler({
202 handler: handler,
203 url: '/api/invites',
204 test: async ({ fetch }) => {
205 const response = await fetch({
206 method: 'POST',
207 body: JSON.stringify({
208 communityId: store.account.id,
209 email: store.invited.email,
210 role: Roles.MEMBER,
211 }),
212 headers: {
213 Authorization: `Bearer ${store.owner.token}`,
214 Host: store.domain.host,
215 Origin: store.domain.origin,
216 'Content-Type': 'application/json',
217 },
218 });
219 expect(response.status).toEqual(200);
220
221 expect(mailerSendMock).toBeCalled();
222 expect(mockEmail).toBeDefined();
223
224 // user will receive an signup email
225 expect(mockEmail.text).toContain(
226 `${store.domain.origin}/signup?email=${encodeURIComponent(
227 store.invited.email
228 )}`
229 );
230 store.invited.signupLink = `${
231 store.domain.origin
232 }/signup?email=${encodeURIComponent(store.invited.email)}`;
233 },
234 });
235
236 mailerSendMock.mockClear();
237}
238
239async function step2_signUp(store: storeType) {
240 let mockEmail2: any;

Callers 1

invites.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected