cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
52d0dde1b5384745b6077e2995c8e406ec275c87

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

tests/api-resources/cache/cache-reserve.test.ts

101lines · modecode

1// File generated from our OpenAPI spec by Stainless.
2
3import Cloudflare from 'cloudflare';
4import { Response } from 'node-fetch';
5
6const cloudflare = new Cloudflare({
7 apiKey: '144c9defac04969c7bfad8efaa8ea194',
8 apiEmail: 'user@example.com',
9 apiToken: 'Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY',
10 userServiceKey:
11 'v1.0-144c9defac04969c7bfad8ef-631a41d003a32d25fe878081ef365c49503f7fada600da935e2851a1c7326084b85cbf6429c4b859de8475731dc92a9c329631e6d59e6c73da7b198497172b4cefe071d90d0f5d2719',
12 baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
13});
14
15describe('resource cacheReserve', () => {
16 // skipped: tests are disabled for the time being
17 test.skip('list: only required params', async () => {
18 const responsePromise = cloudflare.cache.cacheReserve.list({
19 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
20 });
21 const rawResponse = await responsePromise.asResponse();
22 expect(rawResponse).toBeInstanceOf(Response);
23 const response = await responsePromise;
24 expect(response).not.toBeInstanceOf(Response);
25 const dataAndResponse = await responsePromise.withResponse();
26 expect(dataAndResponse.data).toBe(response);
27 expect(dataAndResponse.response).toBe(rawResponse);
28 });
29
30 // skipped: tests are disabled for the time being
31 test.skip('list: required and optional params', async () => {
32 const response = await cloudflare.cache.cacheReserve.list({
33 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
34 });
35 });
36
37 // skipped: tests are disabled for the time being
38 test.skip('clear: only required params', async () => {
39 const responsePromise = cloudflare.cache.cacheReserve.clear({
40 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
41 });
42 const rawResponse = await responsePromise.asResponse();
43 expect(rawResponse).toBeInstanceOf(Response);
44 const response = await responsePromise;
45 expect(response).not.toBeInstanceOf(Response);
46 const dataAndResponse = await responsePromise.withResponse();
47 expect(dataAndResponse.data).toBe(response);
48 expect(dataAndResponse.response).toBe(rawResponse);
49 });
50
51 // skipped: tests are disabled for the time being
52 test.skip('clear: required and optional params', async () => {
53 const response = await cloudflare.cache.cacheReserve.clear({
54 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
55 });
56 });
57
58 // skipped: tests are disabled for the time being
59 test.skip('edit: only required params', async () => {
60 const responsePromise = cloudflare.cache.cacheReserve.edit({
61 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
62 value: 'on',
63 });
64 const rawResponse = await responsePromise.asResponse();
65 expect(rawResponse).toBeInstanceOf(Response);
66 const response = await responsePromise;
67 expect(response).not.toBeInstanceOf(Response);
68 const dataAndResponse = await responsePromise.withResponse();
69 expect(dataAndResponse.data).toBe(response);
70 expect(dataAndResponse.response).toBe(rawResponse);
71 });
72
73 // skipped: tests are disabled for the time being
74 test.skip('edit: required and optional params', async () => {
75 const response = await cloudflare.cache.cacheReserve.edit({
76 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
77 value: 'on',
78 });
79 });
80
81 // skipped: tests are disabled for the time being
82 test.skip('status: only required params', async () => {
83 const responsePromise = cloudflare.cache.cacheReserve.status({
84 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
85 });
86 const rawResponse = await responsePromise.asResponse();
87 expect(rawResponse).toBeInstanceOf(Response);
88 const response = await responsePromise;
89 expect(response).not.toBeInstanceOf(Response);
90 const dataAndResponse = await responsePromise.withResponse();
91 expect(dataAndResponse.data).toBe(response);
92 expect(dataAndResponse.response).toBe(rawResponse);
93 });
94
95 // skipped: tests are disabled for the time being
96 test.skip('status: required and optional params', async () => {
97 const response = await cloudflare.cache.cacheReserve.status({
98 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
99 });
100 });
101});