({
url,
method,
body,
token,
}: {
url: string;
method: string;
body?: any;
token?: string;
})
| 52 | }); |
| 53 | |
| 54 | async function callApi({ |
| 55 | url, |
| 56 | method, |
| 57 | body, |
| 58 | token, |
| 59 | }: { |
| 60 | url: string; |
| 61 | method: string; |
| 62 | body?: any; |
| 63 | token?: string; |
| 64 | }) { |
| 65 | return new Promise(async (res, rej) => { |
| 66 | await testApiHandler({ |
| 67 | handler: handler as any, |
| 68 | url: url, |
| 69 | test: async ({ fetch }) => { |
| 70 | try { |
| 71 | const response = await fetch({ |
| 72 | method: method, |
| 73 | ...attachHeaders({ token: token }), |
| 74 | ...(body && { |
| 75 | body: JSON.stringify(body), |
| 76 | }), |
| 77 | }); |
| 78 | res(response.status); |
| 79 | } catch (error) { |
| 80 | rej(error); |
| 81 | } |
| 82 | }, |
| 83 | }); |
| 84 | }); |
| 85 | } |
| 86 | |
| 87 | describe(`unauthenticated user`, () => { |
| 88 | describe('public community', () => { |
no test coverage detected