// 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("CollectionsClient", () => {
    test("list (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });

        const rawResponseBody = {
            type: "list",
            pages: { type: "offset_pages", page: 1, next: "next", per_page: 1, total_pages: 1 },
            total_count: 1,
            data: [
                {
                    id: "id",
                    workspace_id: "workspace_id",
                    name: "name",
                    description: "description",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                    icon: "icon",
                    order: 1,
                    default_locale: "default_locale",
                    translated_content: {
                        type: "group_translated_content",
                        ar: { type: "group_content", name: "name", description: "description" },
                        bg: { type: "group_content", name: "name", description: "description" },
                        bs: { type: "group_content", name: "name", description: "description" },
                        ca: { type: "group_content", name: "name", description: "description" },
                        cs: { type: "group_content", name: "name", description: "description" },
                        da: { type: "group_content", name: "name", description: "description" },
                        de: { type: "group_content", name: "name", description: "description" },
                        el: { type: "group_content", name: "name", description: "description" },
                        en: { type: "group_content", name: "name", description: "description" },
                        es: { type: "group_content", name: "name", description: "description" },
                        et: { type: "group_content", name: "name", description: "description" },
                        fi: { type: "group_content", name: "name", description: "description" },
                        fr: { type: "group_content", name: "name", description: "description" },
                        he: { type: "group_content", name: "name", description: "description" },
                        hr: { type: "group_content", name: "name", description: "description" },
                        hu: { type: "group_content", name: "name", description: "description" },
                        id: { type: "group_content", name: "name", description: "description" },
                        it: { type: "group_content", name: "name", description: "description" },
                        ja: { type: "group_content", name: "name", description: "description" },
                        ko: { type: "group_content", name: "name", description: "description" },
                        lt: { type: "group_content", name: "name", description: "description" },
                        lv: { type: "group_content", name: "name", description: "description" },
                        mn: { type: "group_content", name: "name", description: "description" },
                        nb: { type: "group_content", name: "name", description: "description" },
                        nl: { type: "group_content", name: "name", description: "description" },
                        pl: { type: "group_content", name: "name", description: "description" },
                        pt: { type: "group_content", name: "name", description: "description" },
                        ro: { type: "group_content", name: "name", description: "description" },
                        ru: { type: "group_content", name: "name", description: "description" },
                        sl: { type: "group_content", name: "name", description: "description" },
                        sr: { type: "group_content", name: "name", description: "description" },
                        sv: { type: "group_content", name: "name", description: "description" },
                        tr: { type: "group_content", name: "name", description: "description" },
                        vi: { type: "group_content", name: "name", description: "description" },
                        "pt-BR": { type: "group_content", name: "name", description: "description" },
                        "zh-CN": { type: "group_content", name: "name", description: "description" },
                        "zh-TW": { type: "group_content", name: "name", description: "description" },
                    },
                    parent_id: "parent_id",
                    help_center_id: 1,
                },
                {
                    id: "id",
                    workspace_id: "workspace_id",
                    name: "name",
                    description: "description",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                    icon: "icon",
                    order: 1,
                    default_locale: "default_locale",
                    translated_content: {
                        type: "group_translated_content",
                        ar: { type: "group_content", name: "name", description: "description" },
                        bg: { type: "group_content", name: "name", description: "description" },
                        bs: { type: "group_content", name: "name", description: "description" },
                        ca: { type: "group_content", name: "name", description: "description" },
                        cs: { type: "group_content", name: "name", description: "description" },
                        da: { type: "group_content", name: "name", description: "description" },
                        de: { type: "group_content", name: "name", description: "description" },
                        el: { type: "group_content", name: "name", description: "description" },
                        en: { type: "group_content", name: "name", description: "description" },
                        es: { type: "group_content", name: "name", description: "description" },
                        et: { type: "group_content", name: "name", description: "description" },
                        fi: { type: "group_content", name: "name", description: "description" },
                        fr: { type: "group_content", name: "name", description: "description" },
                        he: { type: "group_content", name: "name", description: "description" },
                        hr: { type: "group_content", name: "name", description: "description" },
                        hu: { type: "group_content", name: "name", description: "description" },
                        id: { type: "group_content", name: "name", description: "description" },
                        it: { type: "group_content", name: "name", description: "description" },
                        ja: { type: "group_content", name: "name", description: "description" },
                        ko: { type: "group_content", name: "name", description: "description" },
                        lt: { type: "group_content", name: "name", description: "description" },
                        lv: { type: "group_content", name: "name", description: "description" },
                        mn: { type: "group_content", name: "name", description: "description" },
                        nb: { type: "group_content", name: "name", description: "description" },
                        nl: { type: "group_content", name: "name", description: "description" },
                        pl: { type: "group_content", name: "name", description: "description" },
                        pt: { type: "group_content", name: "name", description: "description" },
                        ro: { type: "group_content", name: "name", description: "description" },
                        ru: { type: "group_content", name: "name", description: "description" },
                        sl: { type: "group_content", name: "name", description: "description" },
                        sr: { type: "group_content", name: "name", description: "description" },
                        sv: { type: "group_content", name: "name", description: "description" },
                        tr: { type: "group_content", name: "name", description: "description" },
                        vi: { type: "group_content", name: "name", description: "description" },
                        "pt-BR": { type: "group_content", name: "name", description: "description" },
                        "zh-CN": { type: "group_content", name: "name", description: "description" },
                        "zh-TW": { type: "group_content", name: "name", description: "description" },
                    },
                    parent_id: "parent_id",
                    help_center_id: 1,
                },
            ],
        };
        server
            .mockEndpoint({ once: false })
            .get("/help_center/collections")
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const expected = {
            type: "list",
            pages: {
                type: "offset_pages",
                page: 1,
                next: "next",
                per_page: 1,
                total_pages: 1,
            },
            total_count: 1,
            data: [
                {
                    id: "id",
                    workspace_id: "workspace_id",
                    name: "name",
                    description: "description",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                    icon: "icon",
                    order: 1,
                    default_locale: "default_locale",
                    translated_content: {
                        type: "group_translated_content",
                        ar: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        bg: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        bs: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ca: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        cs: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        da: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        de: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        el: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        en: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        es: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        et: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        fi: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        fr: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        he: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        hr: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        hu: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        id: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        it: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ja: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ko: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        lt: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        lv: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        mn: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        nb: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        nl: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        pl: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        pt: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ro: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ru: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        sl: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        sr: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        sv: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        tr: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        vi: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        "pt-BR": {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        "zh-CN": {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        "zh-TW": {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                    },
                    parent_id: "parent_id",
                    help_center_id: 1,
                },
                {
                    id: "id",
                    workspace_id: "workspace_id",
                    name: "name",
                    description: "description",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                    icon: "icon",
                    order: 1,
                    default_locale: "default_locale",
                    translated_content: {
                        type: "group_translated_content",
                        ar: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        bg: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        bs: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ca: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        cs: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        da: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        de: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        el: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        en: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        es: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        et: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        fi: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        fr: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        he: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        hr: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        hu: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        id: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        it: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ja: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ko: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        lt: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        lv: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        mn: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        nb: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        nl: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        pl: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        pt: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ro: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        ru: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        sl: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        sr: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        sv: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        tr: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        vi: {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        "pt-BR": {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        "zh-CN": {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                        "zh-TW": {
                            type: "group_content",
                            name: "name",
                            description: "description",
                        },
                    },
                    parent_id: "parent_id",
                    help_center_id: 1,
                },
            ],
        };
        const page = await client.helpCenters.collections.list();

        expect(expected.data).toEqual(page.data);
        expect(page.hasNextPage()).toBe(true);
        const nextPage = await page.getNextPage();
        expect(expected.data).toEqual(nextPage.data);
    });

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

        const rawResponseBody = { type: "error.list", errors: [{ code: "code" }, { code: "code" }] };
        server
            .mockEndpoint({ once: false })
            .get("/help_center/collections")
            .respondWith()
            .statusCode(401)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.helpCenters.collections.list();
        }).rejects.toThrow(Intercom.UnauthorizedError);
    });

    test("create (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { name: "Thanks for everything" };
        const rawResponseBody = {
            id: "165",
            workspace_id: "this_is_an_id100_that_should_be_at_least_",
            name: "Thanks for everything",
            description: "",
            created_at: 1734537312,
            updated_at: 1734537312,
            url: "http://help-center.test/myapp-100/",
            icon: "book-bookmark",
            order: 1,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: { type: "group_content", name: "Collection name", description: " Collection description" },
                bg: { type: "group_content", name: "Collection name", description: " Collection description" },
                bs: { type: "group_content", name: "Collection name", description: " Collection description" },
                ca: { type: "group_content", name: "Collection name", description: " Collection description" },
                cs: { type: "group_content", name: "Collection name", description: " Collection description" },
                da: { type: "group_content", name: "Collection name", description: " Collection description" },
                de: { type: "group_content", name: "Collection name", description: " Collection description" },
                el: { type: "group_content", name: "Collection name", description: " Collection description" },
                en: { type: "group_content", name: "Collection name", description: " Collection description" },
                es: { type: "group_content", name: "Collection name", description: " Collection description" },
                et: { type: "group_content", name: "Collection name", description: " Collection description" },
                fi: { type: "group_content", name: "Collection name", description: " Collection description" },
                fr: { type: "group_content", name: "Collection name", description: " Collection description" },
                he: { type: "group_content", name: "Collection name", description: " Collection description" },
                hr: { type: "group_content", name: "Collection name", description: " Collection description" },
                hu: { type: "group_content", name: "Collection name", description: " Collection description" },
                id: { type: "group_content", name: "Collection name", description: " Collection description" },
                it: { type: "group_content", name: "Collection name", description: " Collection description" },
                ja: { type: "group_content", name: "Collection name", description: " Collection description" },
                ko: { type: "group_content", name: "Collection name", description: " Collection description" },
                lt: { type: "group_content", name: "Collection name", description: " Collection description" },
                lv: { type: "group_content", name: "Collection name", description: " Collection description" },
                mn: { type: "group_content", name: "Collection name", description: " Collection description" },
                nb: { type: "group_content", name: "Collection name", description: " Collection description" },
                nl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pt: { type: "group_content", name: "Collection name", description: " Collection description" },
                ro: { type: "group_content", name: "Collection name", description: " Collection description" },
                ru: { type: "group_content", name: "Collection name", description: " Collection description" },
                sl: { type: "group_content", name: "Collection name", description: " Collection description" },
                sr: { type: "group_content", name: "Collection name", description: " Collection description" },
                sv: { type: "group_content", name: "Collection name", description: " Collection description" },
                tr: { type: "group_content", name: "Collection name", description: " Collection description" },
                vi: { type: "group_content", name: "Collection name", description: " Collection description" },
                "pt-BR": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-CN": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-TW": { type: "group_content", name: "Collection name", description: " Collection description" },
            },
            parent_id: "6871118",
            help_center_id: 81,
        };
        server
            .mockEndpoint()
            .post("/help_center/collections")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.helpCenters.collections.create({
            name: "Thanks for everything",
        });
        expect(response).toEqual({
            id: "165",
            workspace_id: "this_is_an_id100_that_should_be_at_least_",
            name: "Thanks for everything",
            description: "",
            created_at: 1734537312,
            updated_at: 1734537312,
            url: "http://help-center.test/myapp-100/",
            icon: "book-bookmark",
            order: 1,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bg: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ca: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                cs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                da: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                de: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                el: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                en: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                es: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                et: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                he: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hu: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                id: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                it: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ja: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ko: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                mn: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nb: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ro: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ru: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                tr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                vi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "pt-BR": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-CN": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-TW": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
            },
            parent_id: "6871118",
            help_center_id: 81,
        });
    });

    test("create (2)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { name: "collection 51", description: "Missing required parameter" };
        const rawResponseBody = {
            id: "165",
            workspace_id: "this_is_an_id100_that_should_be_at_least_",
            name: "Thanks for everything",
            description: "",
            created_at: 1734537312,
            updated_at: 1734537312,
            url: "http://help-center.test/myapp-100/",
            icon: "book-bookmark",
            order: 1,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: { type: "group_content", name: "Collection name", description: " Collection description" },
                bg: { type: "group_content", name: "Collection name", description: " Collection description" },
                bs: { type: "group_content", name: "Collection name", description: " Collection description" },
                ca: { type: "group_content", name: "Collection name", description: " Collection description" },
                cs: { type: "group_content", name: "Collection name", description: " Collection description" },
                da: { type: "group_content", name: "Collection name", description: " Collection description" },
                de: { type: "group_content", name: "Collection name", description: " Collection description" },
                el: { type: "group_content", name: "Collection name", description: " Collection description" },
                en: { type: "group_content", name: "Collection name", description: " Collection description" },
                es: { type: "group_content", name: "Collection name", description: " Collection description" },
                et: { type: "group_content", name: "Collection name", description: " Collection description" },
                fi: { type: "group_content", name: "Collection name", description: " Collection description" },
                fr: { type: "group_content", name: "Collection name", description: " Collection description" },
                he: { type: "group_content", name: "Collection name", description: " Collection description" },
                hr: { type: "group_content", name: "Collection name", description: " Collection description" },
                hu: { type: "group_content", name: "Collection name", description: " Collection description" },
                id: { type: "group_content", name: "Collection name", description: " Collection description" },
                it: { type: "group_content", name: "Collection name", description: " Collection description" },
                ja: { type: "group_content", name: "Collection name", description: " Collection description" },
                ko: { type: "group_content", name: "Collection name", description: " Collection description" },
                lt: { type: "group_content", name: "Collection name", description: " Collection description" },
                lv: { type: "group_content", name: "Collection name", description: " Collection description" },
                mn: { type: "group_content", name: "Collection name", description: " Collection description" },
                nb: { type: "group_content", name: "Collection name", description: " Collection description" },
                nl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pt: { type: "group_content", name: "Collection name", description: " Collection description" },
                ro: { type: "group_content", name: "Collection name", description: " Collection description" },
                ru: { type: "group_content", name: "Collection name", description: " Collection description" },
                sl: { type: "group_content", name: "Collection name", description: " Collection description" },
                sr: { type: "group_content", name: "Collection name", description: " Collection description" },
                sv: { type: "group_content", name: "Collection name", description: " Collection description" },
                tr: { type: "group_content", name: "Collection name", description: " Collection description" },
                vi: { type: "group_content", name: "Collection name", description: " Collection description" },
                "pt-BR": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-CN": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-TW": { type: "group_content", name: "Collection name", description: " Collection description" },
            },
            parent_id: "6871118",
            help_center_id: 81,
        };
        server
            .mockEndpoint()
            .post("/help_center/collections")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.helpCenters.collections.create({
            name: "collection 51",
            description: "Missing required parameter",
        });
        expect(response).toEqual({
            id: "165",
            workspace_id: "this_is_an_id100_that_should_be_at_least_",
            name: "Thanks for everything",
            description: "",
            created_at: 1734537312,
            updated_at: 1734537312,
            url: "http://help-center.test/myapp-100/",
            icon: "book-bookmark",
            order: 1,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bg: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ca: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                cs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                da: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                de: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                el: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                en: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                es: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                et: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                he: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hu: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                id: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                it: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ja: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ko: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                mn: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nb: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ro: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ru: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                tr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                vi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "pt-BR": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-CN": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-TW": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
            },
            parent_id: "6871118",
            help_center_id: 81,
        });
    });

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

        await expect(async () => {
            return await client.helpCenters.collections.create({
                name: "name",
            });
        }).rejects.toThrow(Intercom.BadRequestError);
    });

    test("create (4)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { name: "name" };
        const rawResponseBody = { type: "error.list", errors: [{ code: "code" }, { code: "code" }] };
        server
            .mockEndpoint()
            .post("/help_center/collections")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(401)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.helpCenters.collections.create({
                name: "name",
            });
        }).rejects.toThrow(Intercom.UnauthorizedError);
    });

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

        const rawResponseBody = {
            id: "170",
            workspace_id: "this_is_an_id106_that_should_be_at_least_",
            name: "English collection title",
            description: "english collection description",
            created_at: 1734537315,
            updated_at: 1734537315,
            url: "http://help-center.test/myapp-106/collection-22",
            icon: "bookmark",
            order: 22,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: { type: "group_content", name: "Collection name", description: " Collection description" },
                bg: { type: "group_content", name: "Collection name", description: " Collection description" },
                bs: { type: "group_content", name: "Collection name", description: " Collection description" },
                ca: { type: "group_content", name: "Collection name", description: " Collection description" },
                cs: { type: "group_content", name: "Collection name", description: " Collection description" },
                da: { type: "group_content", name: "Collection name", description: " Collection description" },
                de: { type: "group_content", name: "Collection name", description: " Collection description" },
                el: { type: "group_content", name: "Collection name", description: " Collection description" },
                en: { type: "group_content", name: "Collection name", description: " Collection description" },
                es: { type: "group_content", name: "Collection name", description: " Collection description" },
                et: { type: "group_content", name: "Collection name", description: " Collection description" },
                fi: { type: "group_content", name: "Collection name", description: " Collection description" },
                fr: { type: "group_content", name: "Collection name", description: " Collection description" },
                he: { type: "group_content", name: "Collection name", description: " Collection description" },
                hr: { type: "group_content", name: "Collection name", description: " Collection description" },
                hu: { type: "group_content", name: "Collection name", description: " Collection description" },
                id: { type: "group_content", name: "Collection name", description: " Collection description" },
                it: { type: "group_content", name: "Collection name", description: " Collection description" },
                ja: { type: "group_content", name: "Collection name", description: " Collection description" },
                ko: { type: "group_content", name: "Collection name", description: " Collection description" },
                lt: { type: "group_content", name: "Collection name", description: " Collection description" },
                lv: { type: "group_content", name: "Collection name", description: " Collection description" },
                mn: { type: "group_content", name: "Collection name", description: " Collection description" },
                nb: { type: "group_content", name: "Collection name", description: " Collection description" },
                nl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pt: { type: "group_content", name: "Collection name", description: " Collection description" },
                ro: { type: "group_content", name: "Collection name", description: " Collection description" },
                ru: { type: "group_content", name: "Collection name", description: " Collection description" },
                sl: { type: "group_content", name: "Collection name", description: " Collection description" },
                sr: { type: "group_content", name: "Collection name", description: " Collection description" },
                sv: { type: "group_content", name: "Collection name", description: " Collection description" },
                tr: { type: "group_content", name: "Collection name", description: " Collection description" },
                vi: { type: "group_content", name: "Collection name", description: " Collection description" },
                "pt-BR": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-CN": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-TW": { type: "group_content", name: "Collection name", description: " Collection description" },
            },
            parent_id: "6871118",
            help_center_id: 84,
        };
        server
            .mockEndpoint()
            .get("/help_center/collections/1")
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.helpCenters.collections.find({
            collection_id: 1,
        });
        expect(response).toEqual({
            id: "170",
            workspace_id: "this_is_an_id106_that_should_be_at_least_",
            name: "English collection title",
            description: "english collection description",
            created_at: 1734537315,
            updated_at: 1734537315,
            url: "http://help-center.test/myapp-106/collection-22",
            icon: "bookmark",
            order: 22,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bg: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ca: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                cs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                da: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                de: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                el: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                en: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                es: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                et: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                he: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hu: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                id: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                it: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ja: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ko: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                mn: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nb: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ro: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ru: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                tr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                vi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "pt-BR": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-CN": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-TW": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
            },
            parent_id: "6871118",
            help_center_id: 84,
        });
    });

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

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

        await expect(async () => {
            return await client.helpCenters.collections.find({
                collection_id: 1,
            });
        }).rejects.toThrow(Intercom.UnauthorizedError);
    });

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

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .get("/help_center/collections/1")
            .respondWith()
            .statusCode(404)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.helpCenters.collections.find({
                collection_id: 1,
            });
        }).rejects.toThrow(Intercom.NotFoundError);
    });

    test("update (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { name: "Update collection name" };
        const rawResponseBody = {
            id: "176",
            workspace_id: "this_is_an_id112_that_should_be_at_least_",
            name: "Update collection name",
            description: "english collection description",
            created_at: 1734537318,
            updated_at: 1734537319,
            url: "http://help-center.test/myapp-112/collection-25",
            icon: "folder",
            order: 25,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: { type: "group_content", name: "Collection name", description: " Collection description" },
                bg: { type: "group_content", name: "Collection name", description: " Collection description" },
                bs: { type: "group_content", name: "Collection name", description: " Collection description" },
                ca: { type: "group_content", name: "Collection name", description: " Collection description" },
                cs: { type: "group_content", name: "Collection name", description: " Collection description" },
                da: { type: "group_content", name: "Collection name", description: " Collection description" },
                de: { type: "group_content", name: "Collection name", description: " Collection description" },
                el: { type: "group_content", name: "Collection name", description: " Collection description" },
                en: { type: "group_content", name: "Collection name", description: " Collection description" },
                es: { type: "group_content", name: "Collection name", description: " Collection description" },
                et: { type: "group_content", name: "Collection name", description: " Collection description" },
                fi: { type: "group_content", name: "Collection name", description: " Collection description" },
                fr: { type: "group_content", name: "Collection name", description: " Collection description" },
                he: { type: "group_content", name: "Collection name", description: " Collection description" },
                hr: { type: "group_content", name: "Collection name", description: " Collection description" },
                hu: { type: "group_content", name: "Collection name", description: " Collection description" },
                id: { type: "group_content", name: "Collection name", description: " Collection description" },
                it: { type: "group_content", name: "Collection name", description: " Collection description" },
                ja: { type: "group_content", name: "Collection name", description: " Collection description" },
                ko: { type: "group_content", name: "Collection name", description: " Collection description" },
                lt: { type: "group_content", name: "Collection name", description: " Collection description" },
                lv: { type: "group_content", name: "Collection name", description: " Collection description" },
                mn: { type: "group_content", name: "Collection name", description: " Collection description" },
                nb: { type: "group_content", name: "Collection name", description: " Collection description" },
                nl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pt: { type: "group_content", name: "Collection name", description: " Collection description" },
                ro: { type: "group_content", name: "Collection name", description: " Collection description" },
                ru: { type: "group_content", name: "Collection name", description: " Collection description" },
                sl: { type: "group_content", name: "Collection name", description: " Collection description" },
                sr: { type: "group_content", name: "Collection name", description: " Collection description" },
                sv: { type: "group_content", name: "Collection name", description: " Collection description" },
                tr: { type: "group_content", name: "Collection name", description: " Collection description" },
                vi: { type: "group_content", name: "Collection name", description: " Collection description" },
                "pt-BR": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-CN": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-TW": { type: "group_content", name: "Collection name", description: " Collection description" },
            },
            parent_id: "6871118",
            help_center_id: 87,
        };
        server
            .mockEndpoint()
            .put("/help_center/collections/1")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.helpCenters.collections.update({
            collection_id: 1,
            name: "Update collection name",
        });
        expect(response).toEqual({
            id: "176",
            workspace_id: "this_is_an_id112_that_should_be_at_least_",
            name: "Update collection name",
            description: "english collection description",
            created_at: 1734537318,
            updated_at: 1734537319,
            url: "http://help-center.test/myapp-112/collection-25",
            icon: "folder",
            order: 25,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bg: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ca: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                cs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                da: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                de: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                el: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                en: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                es: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                et: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                he: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hu: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                id: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                it: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ja: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ko: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                mn: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nb: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ro: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ru: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                tr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                vi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "pt-BR": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-CN": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-TW": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
            },
            parent_id: "6871118",
            help_center_id: 87,
        });
    });

    test("update (2)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { name: "Update collection name" };
        const rawResponseBody = {
            id: "176",
            workspace_id: "this_is_an_id112_that_should_be_at_least_",
            name: "Update collection name",
            description: "english collection description",
            created_at: 1734537318,
            updated_at: 1734537319,
            url: "http://help-center.test/myapp-112/collection-25",
            icon: "folder",
            order: 25,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: { type: "group_content", name: "Collection name", description: " Collection description" },
                bg: { type: "group_content", name: "Collection name", description: " Collection description" },
                bs: { type: "group_content", name: "Collection name", description: " Collection description" },
                ca: { type: "group_content", name: "Collection name", description: " Collection description" },
                cs: { type: "group_content", name: "Collection name", description: " Collection description" },
                da: { type: "group_content", name: "Collection name", description: " Collection description" },
                de: { type: "group_content", name: "Collection name", description: " Collection description" },
                el: { type: "group_content", name: "Collection name", description: " Collection description" },
                en: { type: "group_content", name: "Collection name", description: " Collection description" },
                es: { type: "group_content", name: "Collection name", description: " Collection description" },
                et: { type: "group_content", name: "Collection name", description: " Collection description" },
                fi: { type: "group_content", name: "Collection name", description: " Collection description" },
                fr: { type: "group_content", name: "Collection name", description: " Collection description" },
                he: { type: "group_content", name: "Collection name", description: " Collection description" },
                hr: { type: "group_content", name: "Collection name", description: " Collection description" },
                hu: { type: "group_content", name: "Collection name", description: " Collection description" },
                id: { type: "group_content", name: "Collection name", description: " Collection description" },
                it: { type: "group_content", name: "Collection name", description: " Collection description" },
                ja: { type: "group_content", name: "Collection name", description: " Collection description" },
                ko: { type: "group_content", name: "Collection name", description: " Collection description" },
                lt: { type: "group_content", name: "Collection name", description: " Collection description" },
                lv: { type: "group_content", name: "Collection name", description: " Collection description" },
                mn: { type: "group_content", name: "Collection name", description: " Collection description" },
                nb: { type: "group_content", name: "Collection name", description: " Collection description" },
                nl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pl: { type: "group_content", name: "Collection name", description: " Collection description" },
                pt: { type: "group_content", name: "Collection name", description: " Collection description" },
                ro: { type: "group_content", name: "Collection name", description: " Collection description" },
                ru: { type: "group_content", name: "Collection name", description: " Collection description" },
                sl: { type: "group_content", name: "Collection name", description: " Collection description" },
                sr: { type: "group_content", name: "Collection name", description: " Collection description" },
                sv: { type: "group_content", name: "Collection name", description: " Collection description" },
                tr: { type: "group_content", name: "Collection name", description: " Collection description" },
                vi: { type: "group_content", name: "Collection name", description: " Collection description" },
                "pt-BR": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-CN": { type: "group_content", name: "Collection name", description: " Collection description" },
                "zh-TW": { type: "group_content", name: "Collection name", description: " Collection description" },
            },
            parent_id: "6871118",
            help_center_id: 87,
        };
        server
            .mockEndpoint()
            .put("/help_center/collections/1")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.helpCenters.collections.update({
            collection_id: 1,
            name: "Update collection name",
        });
        expect(response).toEqual({
            id: "176",
            workspace_id: "this_is_an_id112_that_should_be_at_least_",
            name: "Update collection name",
            description: "english collection description",
            created_at: 1734537318,
            updated_at: 1734537319,
            url: "http://help-center.test/myapp-112/collection-25",
            icon: "folder",
            order: 25,
            default_locale: "en",
            translated_content: {
                type: "group_translated_content",
                ar: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bg: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                bs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ca: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                cs: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                da: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                de: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                el: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                en: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                es: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                et: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                fr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                he: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                hu: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                id: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                it: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ja: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ko: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                lv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                mn: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nb: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                nl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                pt: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ro: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                ru: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sl: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                sv: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                tr: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                vi: {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "pt-BR": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-CN": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
                "zh-TW": {
                    type: "group_content",
                    name: "Collection name",
                    description: " Collection description",
                },
            },
            parent_id: "6871118",
            help_center_id: 87,
        });
    });

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

        await expect(async () => {
            return await client.helpCenters.collections.update({
                collection_id: 1,
            });
        }).rejects.toThrow(Intercom.UnauthorizedError);
    });

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

        await expect(async () => {
            return await client.helpCenters.collections.update({
                collection_id: 1,
            });
        }).rejects.toThrow(Intercom.NotFoundError);
    });

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

        const rawResponseBody = { id: "182", object: "collection", deleted: true };
        server
            .mockEndpoint()
            .delete("/help_center/collections/1")
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.helpCenters.collections.delete({
            collection_id: 1,
        });
        expect(response).toEqual({
            id: "182",
            object: "collection",
            deleted: true,
        });
    });

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

        const rawResponseBody = { type: "error.list", errors: [{ code: "code" }, { code: "code" }] };
        server
            .mockEndpoint()
            .delete("/help_center/collections/1")
            .respondWith()
            .statusCode(401)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.helpCenters.collections.delete({
                collection_id: 1,
            });
        }).rejects.toThrow(Intercom.UnauthorizedError);
    });

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

        const rawResponseBody = { key: "value" };
        server
            .mockEndpoint()
            .delete("/help_center/collections/1")
            .respondWith()
            .statusCode(404)
            .jsonBody(rawResponseBody)
            .build();

        await expect(async () => {
            return await client.helpCenters.collections.delete({
                collection_id: 1,
            });
        }).rejects.toThrow(Intercom.NotFoundError);
    });
});
