cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
tests/api-resources/acm/total-tls.test.ts
49lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import Cloudflare from 'cloudflare'; |
| 4 | import { Response } from 'node-fetch'; |
| 5 | |
| 6 | const client = 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 totalTLS', () => { |
| 13 | test('create: only required params', async () => { |
| 14 | const responsePromise = client.acm.totalTLS.create({ |
| 15 | zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 16 | enabled: true, |
| 17 | }); |
| 18 | const rawResponse = await responsePromise.asResponse(); |
| 19 | expect(rawResponse).toBeInstanceOf(Response); |
| 20 | const response = await responsePromise; |
| 21 | expect(response).not.toBeInstanceOf(Response); |
| 22 | const dataAndResponse = await responsePromise.withResponse(); |
| 23 | expect(dataAndResponse.data).toBe(response); |
| 24 | expect(dataAndResponse.response).toBe(rawResponse); |
| 25 | }); |
| 26 | |
| 27 | test('create: required and optional params', async () => { |
| 28 | const response = await client.acm.totalTLS.create({ |
| 29 | zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 30 | enabled: true, |
| 31 | certificate_authority: 'google', |
| 32 | }); |
| 33 | }); |
| 34 | |
| 35 | test('get: only required params', async () => { |
| 36 | const responsePromise = client.acm.totalTLS.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); |
| 37 | const rawResponse = await responsePromise.asResponse(); |
| 38 | expect(rawResponse).toBeInstanceOf(Response); |
| 39 | const response = await responsePromise; |
| 40 | expect(response).not.toBeInstanceOf(Response); |
| 41 | const dataAndResponse = await responsePromise.withResponse(); |
| 42 | expect(dataAndResponse.data).toBe(response); |
| 43 | expect(dataAndResponse.response).toBe(rawResponse); |
| 44 | }); |
| 45 | |
| 46 | test('get: required and optional params', async () => { |
| 47 | const response = await client.acm.totalTLS.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); |
| 48 | }); |
| 49 | }); |
| 50 | |