cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
tests/api-resources/accounts/roles.test.ts
46lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. |
| 2 | |
| 3 | import Cloudflare from 'cloudflare'; |
| 4 | import { Response } from 'node-fetch'; |
| 5 | |
| 6 | const cloudflare = new Cloudflare({ |
| 7 | apiKey: '144c9defac04969c7bfad8efaa8ea194', |
| 8 | apiEmail: 'user@example.com', |
| 9 | baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', |
| 10 | }); |
| 11 | |
| 12 | describe('resource roles', () => { |
| 13 | // skipped: tests are disabled for the time being |
| 14 | test.skip('list: only required params', async () => { |
| 15 | const responsePromise = cloudflare.accounts.roles.list({ account_id: {} }); |
| 16 | const rawResponse = await responsePromise.asResponse(); |
| 17 | expect(rawResponse).toBeInstanceOf(Response); |
| 18 | const response = await responsePromise; |
| 19 | expect(response).not.toBeInstanceOf(Response); |
| 20 | const dataAndResponse = await responsePromise.withResponse(); |
| 21 | expect(dataAndResponse.data).toBe(response); |
| 22 | expect(dataAndResponse.response).toBe(rawResponse); |
| 23 | }); |
| 24 | |
| 25 | // skipped: tests are disabled for the time being |
| 26 | test.skip('list: required and optional params', async () => { |
| 27 | const response = await cloudflare.accounts.roles.list({ account_id: {} }); |
| 28 | }); |
| 29 | |
| 30 | // skipped: tests are disabled for the time being |
| 31 | test.skip('get: only required params', async () => { |
| 32 | const responsePromise = cloudflare.accounts.roles.get({}, { account_id: {} }); |
| 33 | const rawResponse = await responsePromise.asResponse(); |
| 34 | expect(rawResponse).toBeInstanceOf(Response); |
| 35 | const response = await responsePromise; |
| 36 | expect(response).not.toBeInstanceOf(Response); |
| 37 | const dataAndResponse = await responsePromise.withResponse(); |
| 38 | expect(dataAndResponse.data).toBe(response); |
| 39 | expect(dataAndResponse.response).toBe(rawResponse); |
| 40 | }); |
| 41 | |
| 42 | // skipped: tests are disabled for the time being |
| 43 | test.skip('get: required and optional params', async () => { |
| 44 | const response = await cloudflare.accounts.roles.get({}, { account_id: {} }); |
| 45 | }); |
| 46 | }); |
| 47 | |