cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
jacobbednarz-patch-1

Branches

Tags

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

Clone

HTTPS

Download ZIP

tests/api-resources/access/bookmarks.test.ts

97lines · modecode

1// File generated from our OpenAPI spec by Stainless.
2
3import Cloudflare from 'cloudflare';
4import { Response } from 'node-fetch';
5
6const cloudflare = new Cloudflare({
7 apiKey: '144c9defac04969c7bfad8efaa8ea194',
8 apiEmail: 'dev@cloudflare.com',
9 apiToken: 'Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY',
10 userServiceKey: 'My User Service Key',
11 baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
12});
13
14describe('resource bookmarks', () => {
15 // skipped: tests are disabled for the time being
16 test.skip('retrieve', async () => {
17 const responsePromise = cloudflare.access.bookmarks.retrieve(
18 '699d98642c564d2e855e9661899b7252',
19 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
20 );
21 const rawResponse = await responsePromise.asResponse();
22 expect(rawResponse).toBeInstanceOf(Response);
23 const response = await responsePromise;
24 expect(response).not.toBeInstanceOf(Response);
25 const dataAndResponse = await responsePromise.withResponse();
26 expect(dataAndResponse.data).toBe(response);
27 expect(dataAndResponse.response).toBe(rawResponse);
28 });
29
30 // skipped: tests are disabled for the time being
31 test.skip('retrieve: request options instead of params are passed correctly', async () => {
32 // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
33 await expect(
34 cloudflare.access.bookmarks.retrieve(
35 '699d98642c564d2e855e9661899b7252',
36 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
37 { path: '/_stainless_unknown_path' },
38 ),
39 ).rejects.toThrow(Cloudflare.NotFoundError);
40 });
41
42 // skipped: tests are disabled for the time being
43 test.skip('update', async () => {
44 const responsePromise = cloudflare.access.bookmarks.update(
45 '699d98642c564d2e855e9661899b7252',
46 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
47 );
48 const rawResponse = await responsePromise.asResponse();
49 expect(rawResponse).toBeInstanceOf(Response);
50 const response = await responsePromise;
51 expect(response).not.toBeInstanceOf(Response);
52 const dataAndResponse = await responsePromise.withResponse();
53 expect(dataAndResponse.data).toBe(response);
54 expect(dataAndResponse.response).toBe(rawResponse);
55 });
56
57 // skipped: tests are disabled for the time being
58 test.skip('delete', async () => {
59 const responsePromise = cloudflare.access.bookmarks.delete(
60 '699d98642c564d2e855e9661899b7252',
61 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
62 );
63 const rawResponse = await responsePromise.asResponse();
64 expect(rawResponse).toBeInstanceOf(Response);
65 const response = await responsePromise;
66 expect(response).not.toBeInstanceOf(Response);
67 const dataAndResponse = await responsePromise.withResponse();
68 expect(dataAndResponse.data).toBe(response);
69 expect(dataAndResponse.response).toBe(rawResponse);
70 });
71
72 // skipped: tests are disabled for the time being
73 test.skip('accessBookmarkApplicationsDeprecatedListBookmarkApplications', async () => {
74 const responsePromise =
75 cloudflare.access.bookmarks.accessBookmarkApplicationsDeprecatedListBookmarkApplications(
76 '699d98642c564d2e855e9661899b7252',
77 );
78 const rawResponse = await responsePromise.asResponse();
79 expect(rawResponse).toBeInstanceOf(Response);
80 const response = await responsePromise;
81 expect(response).not.toBeInstanceOf(Response);
82 const dataAndResponse = await responsePromise.withResponse();
83 expect(dataAndResponse.data).toBe(response);
84 expect(dataAndResponse.response).toBe(rawResponse);
85 });
86
87 // skipped: tests are disabled for the time being
88 test.skip('accessBookmarkApplicationsDeprecatedListBookmarkApplications: request options instead of params are passed correctly', async () => {
89 // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
90 await expect(
91 cloudflare.access.bookmarks.accessBookmarkApplicationsDeprecatedListBookmarkApplications(
92 '699d98642c564d2e855e9661899b7252',
93 { path: '/_stainless_unknown_path' },
94 ),
95 ).rejects.toThrow(Cloudflare.NotFoundError);
96 });
97});