cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
generated-bbc0434d78

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

40lines · 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 cache', () => {
13 // skipped: tests are disabled for the time being
14 test.skip('purge: only required params', async () => {
15 const responsePromise = cloudflare.cache.purge({ zone_id: 'string' });
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('purge: required and optional params', async () => {
27 const response = await cloudflare.cache.purge({
28 zone_id: 'string',
29 files: [
30 'http://www.example.com/css/styles.css',
31 'http://www.example.com/css/styles.css',
32 'http://www.example.com/css/styles.css',
33 ],
34 hosts: ['www.example.com', 'images.example.com'],
35 prefixes: ['www.example.com/foo', 'images.example.com/bar/baz'],
36 purge_everything: true,
37 tags: ['some-tag', 'another-tag'],
38 });
39 });
40});
41