cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
6cd645879ba28ec5e88cbb9be29b7bd86350e1ee

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

32lines · 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 cache', () => {
16 // skipped: tests are disabled for the time being
17 test.skip('purge: only required params', async () => {
18 const responsePromise = cloudflare.cache.purge('string', {});
19 const rawResponse = await responsePromise.asResponse();
20 expect(rawResponse).toBeInstanceOf(Response);
21 const response = await responsePromise;
22 expect(response).not.toBeInstanceOf(Response);
23 const dataAndResponse = await responsePromise.withResponse();
24 expect(dataAndResponse.data).toBe(response);
25 expect(dataAndResponse.response).toBe(rawResponse);
26 });
27
28 // skipped: tests are disabled for the time being
29 test.skip('purge: required and optional params', async () => {
30 const response = await cloudflare.cache.purge('string', { tags: ['some-tag', 'another-tag'] });
31 });
32});
33