cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v3.0.0-beta.14

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

96lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import Cloudflare from 'cloudflare';
4import { Response } from 'node-fetch';
5
6const 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
12describe('resource cacheReserve', () => {
13 // skipped: tests are disabled for the time being
14 test.skip('clear: only required params', async () => {
15 const responsePromise = cloudflare.cache.cacheReserve.clear({
16 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
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 // skipped: tests are disabled for the time being
28 test.skip('clear: required and optional params', async () => {
29 const response = await cloudflare.cache.cacheReserve.clear({
30 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
31 });
32 });
33
34 // skipped: tests are disabled for the time being
35 test.skip('edit: only required params', async () => {
36 const responsePromise = cloudflare.cache.cacheReserve.edit({
37 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
38 value: 'on',
39 });
40 const rawResponse = await responsePromise.asResponse();
41 expect(rawResponse).toBeInstanceOf(Response);
42 const response = await responsePromise;
43 expect(response).not.toBeInstanceOf(Response);
44 const dataAndResponse = await responsePromise.withResponse();
45 expect(dataAndResponse.data).toBe(response);
46 expect(dataAndResponse.response).toBe(rawResponse);
47 });
48
49 // skipped: tests are disabled for the time being
50 test.skip('edit: required and optional params', async () => {
51 const response = await cloudflare.cache.cacheReserve.edit({
52 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
53 value: 'on',
54 });
55 });
56
57 // skipped: tests are disabled for the time being
58 test.skip('get: only required params', async () => {
59 const responsePromise = cloudflare.cache.cacheReserve.get({
60 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
61 });
62 const rawResponse = await responsePromise.asResponse();
63 expect(rawResponse).toBeInstanceOf(Response);
64 const response = await responsePromise;
65 expect(response).not.toBeInstanceOf(Response);
66 const dataAndResponse = await responsePromise.withResponse();
67 expect(dataAndResponse.data).toBe(response);
68 expect(dataAndResponse.response).toBe(rawResponse);
69 });
70
71 // skipped: tests are disabled for the time being
72 test.skip('get: required and optional params', async () => {
73 const response = await cloudflare.cache.cacheReserve.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' });
74 });
75
76 // skipped: tests are disabled for the time being
77 test.skip('status: only required params', async () => {
78 const responsePromise = cloudflare.cache.cacheReserve.status({
79 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
80 });
81 const rawResponse = await responsePromise.asResponse();
82 expect(rawResponse).toBeInstanceOf(Response);
83 const response = await responsePromise;
84 expect(response).not.toBeInstanceOf(Response);
85 const dataAndResponse = await responsePromise.withResponse();
86 expect(dataAndResponse.data).toBe(response);
87 expect(dataAndResponse.response).toBe(rawResponse);
88 });
89
90 // skipped: tests are disabled for the time being
91 test.skip('status: required and optional params', async () => {
92 const response = await cloudflare.cache.cacheReserve.status({
93 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
94 });
95 });
96});
97