cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v6.4.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

tests/api-resources/ai/to-markdown.test.ts

52lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import Cloudflare, { toFile } 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 toMarkdown', () => {
13 test('supported: only required params', async () => {
14 const responsePromise = client.ai.toMarkdown.supported({
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('supported: required and optional params', async () => {
27 const response = await client.ai.toMarkdown.supported({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' });
28 });
29
30 // TODO: investigate prism error for invalid security scheme used
31 test.skip('transform: only required params', async () => {
32 const responsePromise = client.ai.toMarkdown.transform({
33 account_id: '023e105f4ecef8ad9ca31a8372d0c353',
34 file: { files: [await toFile(Buffer.from('Example data'), 'README.md')] },
35 });
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 // TODO: investigate prism error for invalid security scheme used
46 test.skip('transform: required and optional params', async () => {
47 const response = await client.ai.toMarkdown.transform({
48 account_id: '023e105f4ecef8ad9ca31a8372d0c353',
49 file: { files: [await toFile(Buffer.from('Example data'), 'README.md')] },
50 });
51 });
52});
53