// This file was auto-generated by Fern from our API Definition.

import * as Cohere from "../../src/api/index";
import { CohereClient } from "../../src/Client";
import { mockServerPool } from "../mock-server/MockServerPool";

describe("EmbedJobs", () => {
    test("list (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = {
            embed_jobs: [
                {
                    job_id: "job_id",
                    name: "name",
                    status: "processing",
                    created_at: "2024-01-15T09:30:00Z",
                    input_dataset_id: "input_dataset_id",
                    output_dataset_id: "output_dataset_id",
                    model: "model",
                    truncate: "START",
                },
            ],
        };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(200).jsonBody(rawResponseBody).build();

        const response = await client.embedJobs.list();
        expect(response).toEqual({
            embedJobs: [
                {
                    jobId: "job_id",
                    name: "name",
                    status: "processing",
                    createdAt: new Date("2024-01-15T09:30:00.000Z"),
                    inputDatasetId: "input_dataset_id",
                    outputDatasetId: "output_dataset_id",
                    model: "model",
                    truncate: "START",
                },
            ],
        });
    });

    test("list (2)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(400).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.BadRequestError);
    });

    test("list (3)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(401).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.UnauthorizedError);
    });

    test("list (4)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(403).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.ForbiddenError);
    });

    test("list (5)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(404).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.NotFoundError);
    });

    test("list (6)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(422).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.UnprocessableEntityError);
    });

    test("list (7)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(429).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.TooManyRequestsError);
    });

    test("list (8)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(498).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.InvalidTokenError);
    });

    test("list (9)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(499).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.ClientClosedRequestError);
    });

    test("list (10)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(500).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.InternalServerError);
    });

    test("list (11)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(501).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.NotImplementedError);
    });

    test("list (12)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(503).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.ServiceUnavailableError);
    });

    test("list (13)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs").respondWith().statusCode(504).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.list();
        }).rejects.toThrow(Cohere.GatewayTimeoutError);
    });

    test("create (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = {
            job_id: "job_id",
            meta: {
                api_version: { version: "version", is_deprecated: true, is_experimental: true },
                billed_units: {
                    images: 1.1,
                    input_tokens: 1.1,
                    output_tokens: 1.1,
                    search_units: 1.1,
                    classifications: 1.1,
                },
                tokens: { input_tokens: 1.1, output_tokens: 1.1 },
                cached_tokens: 1.1,
                warnings: ["warnings"],
            },
        };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.embedJobs.create({
            model: "model",
            datasetId: "dataset_id",
            inputType: "search_document",
        });
        expect(response).toEqual({
            jobId: "job_id",
            meta: {
                apiVersion: {
                    version: "version",
                    isDeprecated: true,
                    isExperimental: true,
                },
                billedUnits: {
                    images: 1.1,
                    inputTokens: 1.1,
                    outputTokens: 1.1,
                    searchUnits: 1.1,
                    classifications: 1.1,
                },
                tokens: {
                    inputTokens: 1.1,
                    outputTokens: 1.1,
                },
                cachedTokens: 1.1,
                warnings: ["warnings"],
            },
        });
    });

    test("create (2)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(400)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.BadRequestError);
    });

    test("create (3)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(401)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.UnauthorizedError);
    });

    test("create (4)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(403)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.ForbiddenError);
    });

    test("create (5)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(404)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.NotFoundError);
    });

    test("create (6)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(422)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.UnprocessableEntityError);
    });

    test("create (7)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(429)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.TooManyRequestsError);
    });

    test("create (8)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(498)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.InvalidTokenError);
    });

    test("create (9)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(499)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.ClientClosedRequestError);
    });

    test("create (10)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(500)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.InternalServerError);
    });

    test("create (11)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(501)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.NotImplementedError);
    });

    test("create (12)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(503)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.ServiceUnavailableError);
    });

    test("create (13)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });
        const rawRequestBody = { model: "model", dataset_id: "dataset_id", input_type: "search_document" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(504)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.create({
                model: "model",
                datasetId: "dataset_id",
                inputType: "search_document",
            });
        }).rejects.toThrow(Cohere.GatewayTimeoutError);
    });

    test("get (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = {
            job_id: "job_id",
            name: "name",
            status: "processing",
            created_at: "2024-01-15T09:30:00Z",
            input_dataset_id: "input_dataset_id",
            output_dataset_id: "output_dataset_id",
            model: "model",
            truncate: "START",
            meta: {
                api_version: { version: "version", is_deprecated: true, is_experimental: true },
                billed_units: {
                    images: 1.1,
                    input_tokens: 1.1,
                    output_tokens: 1.1,
                    search_units: 1.1,
                    classifications: 1.1,
                },
                tokens: { input_tokens: 1.1, output_tokens: 1.1 },
                cached_tokens: 1.1,
                warnings: ["warnings"],
            },
        };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(200).jsonBody(rawResponseBody).build();

        const response = await client.embedJobs.get("id");
        expect(response).toEqual({
            jobId: "job_id",
            name: "name",
            status: "processing",
            createdAt: new Date("2024-01-15T09:30:00.000Z"),
            inputDatasetId: "input_dataset_id",
            outputDatasetId: "output_dataset_id",
            model: "model",
            truncate: "START",
            meta: {
                apiVersion: {
                    version: "version",
                    isDeprecated: true,
                    isExperimental: true,
                },
                billedUnits: {
                    images: 1.1,
                    inputTokens: 1.1,
                    outputTokens: 1.1,
                    searchUnits: 1.1,
                    classifications: 1.1,
                },
                tokens: {
                    inputTokens: 1.1,
                    outputTokens: 1.1,
                },
                cachedTokens: 1.1,
                warnings: ["warnings"],
            },
        });
    });

    test("get (2)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(400).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.BadRequestError);
    });

    test("get (3)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(401).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.UnauthorizedError);
    });

    test("get (4)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(403).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.ForbiddenError);
    });

    test("get (5)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(404).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.NotFoundError);
    });

    test("get (6)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(422).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.UnprocessableEntityError);
    });

    test("get (7)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(429).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.TooManyRequestsError);
    });

    test("get (8)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(498).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.InvalidTokenError);
    });

    test("get (9)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(499).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.ClientClosedRequestError);
    });

    test("get (10)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(500).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.InternalServerError);
    });

    test("get (11)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(501).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.NotImplementedError);
    });

    test("get (12)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(503).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.ServiceUnavailableError);
    });

    test("get (13)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server.mockEndpoint().get("/v1/embed-jobs/id").respondWith().statusCode(504).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.embedJobs.get("id");
        }).rejects.toThrow(Cohere.GatewayTimeoutError);
    });

    test("cancel (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        server.mockEndpoint().post("/v1/embed-jobs/id/cancel").respondWith().statusCode(200).build();

        const response = await client.embedJobs.cancel("id");
        expect(response).toEqual(undefined);
    });

    test("cancel (2)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(400)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.BadRequestError);
    });

    test("cancel (3)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(401)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.UnauthorizedError);
    });

    test("cancel (4)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(403)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.ForbiddenError);
    });

    test("cancel (5)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(404)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.NotFoundError);
    });

    test("cancel (6)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(422)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.UnprocessableEntityError);
    });

    test("cancel (7)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(429)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.TooManyRequestsError);
    });

    test("cancel (8)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(498)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.InvalidTokenError);
    });

    test("cancel (9)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(499)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.ClientClosedRequestError);
    });

    test("cancel (10)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(500)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.InternalServerError);
    });

    test("cancel (11)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(501)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.NotImplementedError);
    });

    test("cancel (12)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(503)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.ServiceUnavailableError);
    });

    test("cancel (13)", async () => {
        const server = mockServerPool.createServer();
        const client = new CohereClient({ token: "test", clientName: "test", environment: server.baseUrl });

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/v1/embed-jobs/id/cancel")
            .respondWith()
            .statusCode(504)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.embedJobs.cancel("id");
        }).rejects.toThrow(Cohere.GatewayTimeoutError);
    });
});
