cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.0.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

tests/api-resources/ai-gateway/evaluation-types.test.ts

35lines · 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 evaluationTypes', () => {
13 test('get: only required params', async () => {
14 const responsePromise = client.aiGateway.evaluationTypes.get({
15 account_id: '0d37909e38d3e99c29fa2cd343ac421a',
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('get: required and optional params', async () => {
27 const response = await client.aiGateway.evaluationTypes.get({
28 account_id: '0d37909e38d3e99c29fa2cd343ac421a',
29 order_by: 'order_by',
30 order_by_direction: 'asc',
31 page: 1,
32 per_page: 5,
33 });
34 });
35});
36