| 342 | } |
| 343 | |
| 344 | async function step5_postThread(store: storeType) { |
| 345 | await testApiHandler({ |
| 346 | handler: handlerThreads as any, |
| 347 | url: `/api/threads`, |
| 348 | test: async ({ fetch }) => { |
| 349 | const response = await fetch({ |
| 350 | method: 'POST', |
| 351 | headers: { |
| 352 | 'Content-Type': 'application/json', |
| 353 | Authorization: `Bearer ${store.invited.token}`, |
| 354 | Host: store.domain.host, |
| 355 | Origin: store.domain.origin, |
| 356 | }, |
| 357 | body: JSON.stringify({ |
| 358 | accountId: store.account.id, |
| 359 | channelId: store.channel.id, |
| 360 | body: 'hello', |
| 361 | }), |
| 362 | }); |
| 363 | expect(response.status).toEqual(200); |
| 364 | expect(response.json()).resolves.toMatchObject({ |
| 365 | thread: expect.any(Object), |
| 366 | }); |
| 367 | // expect(eventNewThreadMock).toBeCalledTimes(1); |
| 368 | }, |
| 369 | }); |
| 370 | } |