cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.3.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

tests/api-resources/botnet-feed/asn.test.ts

51lines · 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 asn', () => {
13 test('dayReport: only required params', async () => {
14 const responsePromise = client.botnetFeed.asn.dayReport(0, {
15 account_id: '023e105f4ecef8ad9ca31a8372d0c353',
16 });
17 const rawResponse = await responsePromise.asResponse();
18 expect(rawResponse).toBeInstanceOf(Response);
19 const response = await responsePromise;
20 expect(response).not.toBeInstanceOf(Response);
21 const dataAndResponse = await responsePromise.withResponse();
22 expect(dataAndResponse.data).toBe(response);
23 expect(dataAndResponse.response).toBe(rawResponse);
24 });
25
26 test('dayReport: required and optional params', async () => {
27 const response = await client.botnetFeed.asn.dayReport(0, {
28 account_id: '023e105f4ecef8ad9ca31a8372d0c353',
29 date: '2014-01-01T05:20:00.12345Z',
30 });
31 });
32
33 test('fullReport: only required params', async () => {
34 const responsePromise = client.botnetFeed.asn.fullReport(0, {
35 account_id: '023e105f4ecef8ad9ca31a8372d0c353',
36 });
37 const rawResponse = await responsePromise.asResponse();
38 expect(rawResponse).toBeInstanceOf(Response);
39 const response = await responsePromise;
40 expect(response).not.toBeInstanceOf(Response);
41 const dataAndResponse = await responsePromise.withResponse();
42 expect(dataAndResponse.data).toBe(response);
43 expect(dataAndResponse.response).toBe(rawResponse);
44 });
45
46 test('fullReport: required and optional params', async () => {
47 const response = await client.botnetFeed.asn.fullReport(0, {
48 account_id: '023e105f4ecef8ad9ca31a8372d0c353',
49 });
50 });
51});
52