cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v3.5.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

tests/api-resources/argo/smart-routing.test.ts

48lines · 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 smartRouting', () => {
13 test('edit: only required params', async () => {
14 const responsePromise = cloudflare.argo.smartRouting.edit({
15 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
16 value: 'on',
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 test('edit: required and optional params', async () => {
28 const response = await cloudflare.argo.smartRouting.edit({
29 zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
30 value: 'on',
31 });
32 });
33
34 test('get: only required params', async () => {
35 const responsePromise = cloudflare.argo.smartRouting.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' });
36 const rawResponse = await responsePromise.asResponse();
37 expect(rawResponse).toBeInstanceOf(Response);
38 const response = await responsePromise;
39 expect(response).not.toBeInstanceOf(Response);
40 const dataAndResponse = await responsePromise.withResponse();
41 expect(dataAndResponse.data).toBe(response);
42 expect(dataAndResponse.response).toBe(rawResponse);
43 });
44
45 test('get: required and optional params', async () => {
46 const response = await cloudflare.argo.smartRouting.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' });
47 });
48});
49