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

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

describe("DataAttributesClient", () => {
    test("lisDataAttributes (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });

        const rawResponseBody = {
            type: "list",
            data: [
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "name",
                    full_name: "name",
                    label: "Company name",
                    description: "The name of a company",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "company_id",
                    full_name: "company_id",
                    label: "Company ID",
                    description: "A number identifying a company",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "last_request_at",
                    full_name: "last_request_at",
                    label: "Company last seen",
                    description: "The last day anyone from a company visited your site or app",
                    data_type: "date",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "remote_created_at",
                    full_name: "remote_created_at",
                    label: "Company created at",
                    description: "The day a company was added to Intercom",
                    data_type: "date",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "user_count",
                    full_name: "user_count",
                    label: "People",
                    description: "The number of people in a company",
                    data_type: "integer",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "session_count",
                    full_name: "session_count",
                    label: "Company web sessions",
                    description: "All visits from anyone in a company to your product's site or app",
                    data_type: "integer",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "name",
                    full_name: "plan.name",
                    label: "Plan",
                    description: "A specific plan or level within your product that companies have signed up to",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "monthly_spend",
                    full_name: "monthly_spend",
                    label: "Monthly Spend",
                    description: "The monthly revenue you receive from a company",
                    data_type: "float",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "size",
                    full_name: "size",
                    label: "Company size",
                    description: "The number of people employed in this company, expressed as a single number",
                    data_type: "integer",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "industry",
                    full_name: "industry",
                    label: "Company industry",
                    description: "The category or domain this company belongs to e.g. 'ecommerce' or 'SaaS'",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "website",
                    full_name: "website",
                    label: "Company website",
                    description: "The web address for the company's primary marketing site",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 34,
                    model: "company",
                    name: "The One Ring",
                    full_name: "custom_attributes.The One Ring",
                    label: "The One Ring",
                    description:
                        "One ring to rule them all, one ring to find them, One ring to bring them all and in the darkness bind them.",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: true,
                    archived: false,
                    created_at: 1734537753,
                    updated_at: 1734537753,
                    admin_id: "991267784",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "id",
                    full_name: "id",
                    label: "ID",
                    description: "The Intercom defined id representing the company",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "created_at",
                    full_name: "created_at",
                    label: "Created at",
                    description: "The time the company was added to Intercom",
                    data_type: "date",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "updated_at",
                    full_name: "updated_at",
                    label: "Updated at",
                    description: "The last time the company was updated",
                    data_type: "date",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "id",
                    full_name: "plan.id",
                    label: "Plan ID",
                    description: "The Intercom defined id representing the plan",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "app_id",
                    full_name: "app_id",
                    label: "App ID",
                    description: "The Intercom defined id representing the app",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
            ],
        };
        server.mockEndpoint().get("/data_attributes").respondWith().statusCode(200).jsonBody(rawResponseBody).build();

        const response = await client.unstable.dataAttributes.lisDataAttributes({
            model: "contact",
            include_archived: true,
        });
        expect(response).toEqual({
            type: "list",
            data: [
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "name",
                    full_name: "name",
                    label: "Company name",
                    description: "The name of a company",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "company_id",
                    full_name: "company_id",
                    label: "Company ID",
                    description: "A number identifying a company",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "last_request_at",
                    full_name: "last_request_at",
                    label: "Company last seen",
                    description: "The last day anyone from a company visited your site or app",
                    data_type: "date",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "remote_created_at",
                    full_name: "remote_created_at",
                    label: "Company created at",
                    description: "The day a company was added to Intercom",
                    data_type: "date",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "user_count",
                    full_name: "user_count",
                    label: "People",
                    description: "The number of people in a company",
                    data_type: "integer",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "session_count",
                    full_name: "session_count",
                    label: "Company web sessions",
                    description: "All visits from anyone in a company to your product's site or app",
                    data_type: "integer",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "name",
                    full_name: "plan.name",
                    label: "Plan",
                    description: "A specific plan or level within your product that companies have signed up to",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "monthly_spend",
                    full_name: "monthly_spend",
                    label: "Monthly Spend",
                    description: "The monthly revenue you receive from a company",
                    data_type: "float",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "size",
                    full_name: "size",
                    label: "Company size",
                    description: "The number of people employed in this company, expressed as a single number",
                    data_type: "integer",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "industry",
                    full_name: "industry",
                    label: "Company industry",
                    description: "The category or domain this company belongs to e.g. 'ecommerce' or 'SaaS'",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "website",
                    full_name: "website",
                    label: "Company website",
                    description: "The web address for the company's primary marketing site",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 34,
                    model: "company",
                    name: "The One Ring",
                    full_name: "custom_attributes.The One Ring",
                    label: "The One Ring",
                    description:
                        "One ring to rule them all, one ring to find them, One ring to bring them all and in the darkness bind them.",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: true,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: true,
                    archived: false,
                    created_at: 1734537753,
                    updated_at: 1734537753,
                    admin_id: "991267784",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "id",
                    full_name: "id",
                    label: "ID",
                    description: "The Intercom defined id representing the company",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "created_at",
                    full_name: "created_at",
                    label: "Created at",
                    description: "The time the company was added to Intercom",
                    data_type: "date",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "updated_at",
                    full_name: "updated_at",
                    label: "Updated at",
                    description: "The last time the company was updated",
                    data_type: "date",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "id",
                    full_name: "plan.id",
                    label: "Plan ID",
                    description: "The Intercom defined id representing the plan",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
                {
                    type: "data_attribute",
                    id: 12878,
                    model: "company",
                    name: "app_id",
                    full_name: "app_id",
                    label: "App ID",
                    description: "The Intercom defined id representing the app",
                    data_type: "string",
                    options: ["true", "false"],
                    api_writable: false,
                    messenger_writable: true,
                    ui_writable: false,
                    custom: false,
                    archived: false,
                    created_at: 1671028894,
                    updated_at: 1671028894,
                    admin_id: "5712945",
                },
            ],
        });
    });

    test("lisDataAttributes (2)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });

        const rawResponseBody = { type: "type", errors: [{ code: "code" }, { code: "code" }] };
        server.mockEndpoint().get("/data_attributes").respondWith().statusCode(401).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.unstable.dataAttributes.lisDataAttributes();
        }).rejects.toThrow(Intercom.unstable.UnauthorizedError);
    });

    test("createDataAttribute (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { key: "value" };
        const rawResponseBody = {
            type: "data_attribute",
            id: 1,
            model: "contact",
            name: "name",
            full_name: "full_name",
            label: "label",
            description: "description",
            data_type: "string",
            options: ["options", "options"],
            api_writable: true,
            messenger_writable: true,
            ui_writable: true,
            custom: true,
            archived: true,
            created_at: 1,
            updated_at: 1,
            admin_id: "admin_id",
        };
        server
            .mockEndpoint()
            .post("/data_attributes")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.unstable.dataAttributes.createDataAttribute({
            key: "value",
        });
        expect(response).toEqual({
            type: "data_attribute",
            id: 1,
            model: "contact",
            name: "name",
            full_name: "full_name",
            label: "label",
            description: "description",
            data_type: "string",
            options: ["options", "options"],
            api_writable: true,
            messenger_writable: true,
            ui_writable: true,
            custom: true,
            archived: true,
            created_at: 1,
            updated_at: 1,
            admin_id: "admin_id",
        });
    });

    test("createDataAttribute (2)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { key: "value" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .post("/data_attributes")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(400)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.unstable.dataAttributes.createDataAttribute({
                key: "value",
            });
        }).rejects.toThrow(Intercom.unstable.BadRequestError);
    });

    test("createDataAttribute (3)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { key: "value" };
        const rawResponseBody = { type: "type", errors: [{ code: "code" }, { code: "code" }] };
        server
            .mockEndpoint()
            .post("/data_attributes")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(401)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.unstable.dataAttributes.createDataAttribute({
                key: "value",
            });
        }).rejects.toThrow(Intercom.unstable.UnauthorizedError);
    });

    test("updateDataAttribute (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { key: "value" };
        const rawResponseBody = {
            type: "data_attribute",
            id: 1,
            model: "contact",
            name: "name",
            full_name: "full_name",
            label: "label",
            description: "description",
            data_type: "string",
            options: ["options", "options"],
            api_writable: true,
            messenger_writable: true,
            ui_writable: true,
            custom: true,
            archived: true,
            created_at: 1,
            updated_at: 1,
            admin_id: "admin_id",
        };
        server
            .mockEndpoint()
            .put("/data_attributes/1")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.unstable.dataAttributes.updateDataAttribute({
            id: 1,
            body: {
                key: "value",
            },
        });
        expect(response).toEqual({
            type: "data_attribute",
            id: 1,
            model: "contact",
            name: "name",
            full_name: "full_name",
            label: "label",
            description: "description",
            data_type: "string",
            options: ["options", "options"],
            api_writable: true,
            messenger_writable: true,
            ui_writable: true,
            custom: true,
            archived: true,
            created_at: 1,
            updated_at: 1,
            admin_id: "admin_id",
        });
    });

    test("updateDataAttribute (2)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { key: "value" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .put("/data_attributes/1")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(400)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.unstable.dataAttributes.updateDataAttribute({
                id: 1,
                body: {
                    key: "value",
                },
            });
        }).rejects.toThrow(Intercom.unstable.BadRequestError);
    });

    test("updateDataAttribute (3)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { key: "value" };
        const rawResponseBody = { type: "type", errors: [{ code: "code" }, { code: "code" }] };
        server
            .mockEndpoint()
            .put("/data_attributes/1")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(401)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.unstable.dataAttributes.updateDataAttribute({
                id: 1,
                body: {
                    key: "value",
                },
            });
        }).rejects.toThrow(Intercom.unstable.UnauthorizedError);
    });

    test("updateDataAttribute (4)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { key: "value" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .put("/data_attributes/1")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(404)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.unstable.dataAttributes.updateDataAttribute({
                id: 1,
                body: {
                    key: "value",
                },
            });
        }).rejects.toThrow(Intercom.unstable.NotFoundError);
    });

    test("updateDataAttribute (5)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { key: "value" };
        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .put("/data_attributes/1")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(422)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.unstable.dataAttributes.updateDataAttribute({
                id: 1,
                body: {
                    key: "value",
                },
            });
        }).rejects.toThrow(Intercom.unstable.UnprocessableEntityError);
    });
});
