-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbrowsers.test.ts
More file actions
118 lines (107 loc) · 4.83 KB
/
browsers.test.ts
File metadata and controls
118 lines (107 loc) · 4.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import Kernel, { toFile } from '@onkernel/sdk';
const client = new Kernel({
apiKey: 'My API Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
describe('resource browsers', () => {
// Prism tests are disabled
test.skip('create', async () => {
const responsePromise = client.browsers.create();
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('create: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.browsers.create(
{
extensions: [{ id: 'id', name: 'name' }],
headless: false,
invocation_id: 'rr33xuugxj9h0bkf1rdt2bet',
kiosk_mode: true,
persistence: { id: 'my-awesome-browser-for-user-1234' },
profile: { id: 'id', name: 'name', save_changes: true },
proxy_id: 'proxy_id',
stealth: true,
timeout_seconds: 10,
viewport: { height: 800, width: 1280, refresh_rate: 60 },
},
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(Kernel.NotFoundError);
});
// Prism tests are disabled
test.skip('retrieve', async () => {
const responsePromise = client.browsers.retrieve('htzv5orfit78e1m2biiifpbv');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('list', async () => {
const responsePromise = client.browsers.list();
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('delete: only required params', async () => {
const responsePromise = client.browsers.delete({ persistent_id: 'persistent_id' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('delete: required and optional params', async () => {
const response = await client.browsers.delete({ persistent_id: 'persistent_id' });
});
// Prism tests are disabled
test.skip('deleteByID', async () => {
const responsePromise = client.browsers.deleteByID('htzv5orfit78e1m2biiifpbv');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('loadExtensions: only required params', async () => {
const responsePromise = client.browsers.loadExtensions('id', {
extensions: [{ name: 'name', zip_file: await toFile(Buffer.from('# my file contents'), 'README.md') }],
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('loadExtensions: required and optional params', async () => {
const response = await client.browsers.loadExtensions('id', {
extensions: [{ name: 'name', zip_file: await toFile(Buffer.from('# my file contents'), 'README.md') }],
});
});
});