cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v6.3.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

tests/api-resources/ai-security/custom-topics.test.ts

55lines · 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 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
12describe('resource customTopics', () => {
13 // HTTP 404 error from prism
14 test.skip('update: only required params', async () => {
15 const responsePromise = client.aiSecurity.customTopics.update({
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 // HTTP 404 error from prism
28 test.skip('update: required and optional params', async () => {
29 const response = await client.aiSecurity.customTopics.update({
30 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
31 topics: [{ label: 'credit-cards', topic: 'credit card numbers' }],
32 });
33 });
34
35 // HTTP 404 error from prism
36 test.skip('get: only required params', async () => {
37 const responsePromise = client.aiSecurity.customTopics.get({
38 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
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 // HTTP 404 error from prism
50 test.skip('get: required and optional params', async () => {
51 const response = await client.aiSecurity.customTopics.get({
52 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
53 });
54 });
55});
56