Publish npm package using Trusted Publisher (#3953)

This commit is contained in:
Stanislav Novosad
2025-11-10 13:51:53 -07:00
committed by GitHub
parent af88a7912b
commit e3cd3eeae0
43 changed files with 2143 additions and 290 deletions

View File

@@ -0,0 +1,236 @@
// This file was auto-generated by Fern from our API Definition.
import * as Skyvern from "../../src/api/index";
import { SkyvernClient } from "../../src/Client";
import { mockServerPool } from "../mock-server/MockServerPool";
describe("BrowserProfiles", () => {
test("listBrowserProfiles (1)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
const rawResponseBody = [
{
browser_profile_id: "browser_profile_id",
organization_id: "organization_id",
name: "name",
description: "description",
created_at: "2024-01-15T09:30:00Z",
modified_at: "2024-01-15T09:30:00Z",
deleted_at: "2024-01-15T09:30:00Z",
},
];
server
.mockEndpoint()
.get("/v1/browser_profiles")
.respondWith()
.statusCode(200)
.jsonBody(rawResponseBody)
.build();
const response = await client.browserProfiles.listBrowserProfiles({
include_deleted: true,
});
expect(response).toEqual([
{
browser_profile_id: "browser_profile_id",
organization_id: "organization_id",
name: "name",
description: "description",
created_at: "2024-01-15T09:30:00Z",
modified_at: "2024-01-15T09:30:00Z",
deleted_at: "2024-01-15T09:30:00Z",
},
]);
});
test("listBrowserProfiles (2)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
const rawResponseBody = { key: "value" };
server
.mockEndpoint()
.get("/v1/browser_profiles")
.respondWith()
.statusCode(422)
.jsonBody(rawResponseBody)
.build();
await expect(async () => {
return await client.browserProfiles.listBrowserProfiles();
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
});
test("createBrowserProfile (1)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
const rawRequestBody = { name: "name" };
const rawResponseBody = {
browser_profile_id: "browser_profile_id",
organization_id: "organization_id",
name: "name",
description: "description",
created_at: "2024-01-15T09:30:00Z",
modified_at: "2024-01-15T09:30:00Z",
deleted_at: "2024-01-15T09:30:00Z",
};
server
.mockEndpoint()
.post("/v1/browser_profiles")
.jsonBody(rawRequestBody)
.respondWith()
.statusCode(200)
.jsonBody(rawResponseBody)
.build();
const response = await client.browserProfiles.createBrowserProfile({
name: "name",
});
expect(response).toEqual({
browser_profile_id: "browser_profile_id",
organization_id: "organization_id",
name: "name",
description: "description",
created_at: "2024-01-15T09:30:00Z",
modified_at: "2024-01-15T09:30:00Z",
deleted_at: "2024-01-15T09:30:00Z",
});
});
test("createBrowserProfile (2)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
const rawRequestBody = { name: "name" };
const rawResponseBody = { key: "value" };
server
.mockEndpoint()
.post("/v1/browser_profiles")
.jsonBody(rawRequestBody)
.respondWith()
.statusCode(422)
.jsonBody(rawResponseBody)
.build();
await expect(async () => {
return await client.browserProfiles.createBrowserProfile({
name: "name",
});
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
});
test("getBrowserProfile (1)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
const rawResponseBody = {
browser_profile_id: "browser_profile_id",
organization_id: "organization_id",
name: "name",
description: "description",
created_at: "2024-01-15T09:30:00Z",
modified_at: "2024-01-15T09:30:00Z",
deleted_at: "2024-01-15T09:30:00Z",
};
server
.mockEndpoint()
.get("/v1/browser_profiles/bp_123456")
.respondWith()
.statusCode(200)
.jsonBody(rawResponseBody)
.build();
const response = await client.browserProfiles.getBrowserProfile("bp_123456");
expect(response).toEqual({
browser_profile_id: "browser_profile_id",
organization_id: "organization_id",
name: "name",
description: "description",
created_at: "2024-01-15T09:30:00Z",
modified_at: "2024-01-15T09:30:00Z",
deleted_at: "2024-01-15T09:30:00Z",
});
});
test("getBrowserProfile (2)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
const rawResponseBody = { key: "value" };
server
.mockEndpoint()
.get("/v1/browser_profiles/profile_id")
.respondWith()
.statusCode(404)
.jsonBody(rawResponseBody)
.build();
await expect(async () => {
return await client.browserProfiles.getBrowserProfile("profile_id");
}).rejects.toThrow(Skyvern.NotFoundError);
});
test("getBrowserProfile (3)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
const rawResponseBody = { key: "value" };
server
.mockEndpoint()
.get("/v1/browser_profiles/profile_id")
.respondWith()
.statusCode(422)
.jsonBody(rawResponseBody)
.build();
await expect(async () => {
return await client.browserProfiles.getBrowserProfile("profile_id");
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
});
test("deleteBrowserProfile (1)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
server.mockEndpoint().delete("/v1/browser_profiles/bp_123456").respondWith().statusCode(200).build();
const response = await client.browserProfiles.deleteBrowserProfile("bp_123456");
expect(response).toEqual(undefined);
});
test("deleteBrowserProfile (2)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
const rawResponseBody = { key: "value" };
server
.mockEndpoint()
.delete("/v1/browser_profiles/profile_id")
.respondWith()
.statusCode(404)
.jsonBody(rawResponseBody)
.build();
await expect(async () => {
return await client.browserProfiles.deleteBrowserProfile("profile_id");
}).rejects.toThrow(Skyvern.NotFoundError);
});
test("deleteBrowserProfile (3)", async () => {
const server = mockServerPool.createServer();
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
const rawResponseBody = { key: "value" };
server
.mockEndpoint()
.delete("/v1/browser_profiles/profile_id")
.respondWith()
.statusCode(422)
.jsonBody(rawResponseBody)
.build();
await expect(async () => {
return await client.browserProfiles.deleteBrowserProfile("profile_id");
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
});
});

View File

@@ -26,6 +26,7 @@ describe("SkyvernClient", () => {
finished_at: "2024-01-15T09:30:00Z",
app_url: "app_url",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
script_run: { ai_fallback_triggered: true },
errors: [{ key: "value" }],
@@ -90,6 +91,7 @@ describe("SkyvernClient", () => {
finished_at: "2024-01-15T09:30:00Z",
app_url: "app_url",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
script_run: {
ai_fallback_triggered: true,
@@ -197,6 +199,7 @@ describe("SkyvernClient", () => {
finished_at: "2024-01-15T09:30:00Z",
app_url: "app_url",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
script_run: { ai_fallback_triggered: true },
errors: [{ key: "value" }],
@@ -211,6 +214,7 @@ describe("SkyvernClient", () => {
totp_url: "totp_url",
totp_identifier: "totp_identifier",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
extra_http_headers: { key: "value" },
browser_address: "browser_address",
@@ -261,6 +265,7 @@ describe("SkyvernClient", () => {
finished_at: "2024-01-15T09:30:00Z",
app_url: "app_url",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
script_run: {
ai_fallback_triggered: true,
@@ -283,6 +288,7 @@ describe("SkyvernClient", () => {
totp_url: "totp_url",
totp_identifier: "totp_identifier",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
extra_http_headers: {
key: "value",
@@ -362,6 +368,7 @@ describe("SkyvernClient", () => {
finished_at: "2024-01-15T09:30:00Z",
app_url: "app_url",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
script_run: { ai_fallback_triggered: true },
errors: [{ key: "value" }],
@@ -414,6 +421,7 @@ describe("SkyvernClient", () => {
finished_at: "2024-01-15T09:30:00Z",
app_url: "app_url",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
script_run: {
ai_fallback_triggered: true,
@@ -728,7 +736,10 @@ describe("SkyvernClient", () => {
.jsonBody(rawResponseBody)
.build();
const response = await client.createWorkflow({});
const response = await client.createWorkflow({
folder_id: "folder_id",
body: {},
});
expect(response).toEqual({
workflow_id: "workflow_id",
organization_id: "organization_id",
@@ -804,7 +815,9 @@ describe("SkyvernClient", () => {
.build();
await expect(async () => {
return await client.createWorkflow({});
return await client.createWorkflow({
body: {},
});
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
});
@@ -2070,6 +2083,7 @@ describe("SkyvernClient", () => {
finished_at: "2024-01-15T09:30:00Z",
app_url: "app_url",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
script_run: { ai_fallback_triggered: true },
errors: [{ key: "value" }],
@@ -2084,6 +2098,7 @@ describe("SkyvernClient", () => {
totp_url: "totp_url",
totp_identifier: "totp_identifier",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
extra_http_headers: { key: "value" },
browser_address: "browser_address",
@@ -2127,6 +2142,7 @@ describe("SkyvernClient", () => {
finished_at: "2024-01-15T09:30:00Z",
app_url: "app_url",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
script_run: {
ai_fallback_triggered: true,
@@ -2149,6 +2165,7 @@ describe("SkyvernClient", () => {
totp_url: "totp_url",
totp_identifier: "totp_identifier",
browser_session_id: "browser_session_id",
browser_profile_id: "browser_profile_id",
max_screenshot_scrolls: 1,
extra_http_headers: {
key: "value",