// 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("ArticlesClient", () => {
    test("listArticles (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: "pages",
                page: 1,
                next: { per_page: 2, starting_after: "your-cursor-from-response" },
                per_page: 25,
                total_pages: 1,
            },
            total_count: 1,
            data: [
                {
                    type: "article",
                    id: "39",
                    workspace_id: "this_is_an_id64_that_should_be_at_least_4",
                    title: "This is the article title",
                    description: "",
                    body: "",
                    author_id: 991267492,
                    state: "published",
                    created_at: 1734537283,
                    updated_at: 1734537283,
                    url: "http://help-center.test/myapp-64/en/articles/39-this-is-the-article-title",
                    parent_id: 143,
                    parent_ids: [18, 19],
                    parent_type: "collection",
                    default_locale: "en",
                },
            ],
        };
        server.mockEndpoint().get("/articles").respondWith().statusCode(200).jsonBody(rawResponseBody).build();

        const response = await client.unstable.articles.listArticles();
        expect(response).toEqual({
            type: "list",
            pages: {
                type: "pages",
                page: 1,
                next: {
                    per_page: 2,
                    starting_after: "your-cursor-from-response",
                },
                per_page: 25,
                total_pages: 1,
            },
            total_count: 1,
            data: [
                {
                    type: "article",
                    id: "39",
                    workspace_id: "this_is_an_id64_that_should_be_at_least_4",
                    title: "This is the article title",
                    description: "",
                    body: "",
                    author_id: 991267492,
                    state: "published",
                    created_at: 1734537283,
                    updated_at: 1734537283,
                    url: "http://help-center.test/myapp-64/en/articles/39-this-is-the-article-title",
                    parent_id: 143,
                    parent_ids: [18, 19],
                    parent_type: "collection",
                    default_locale: "en",
                },
            ],
        });
    });

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

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

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

    test("createArticle (1)", async () => {
        const server = mockServerPool.createServer();
        const client = new IntercomClient({
            maxRetries: 0,
            token: "test",
            version: "2.14",
            environment: server.baseUrl,
        });
        const rawRequestBody = { key: "value" };
        const rawResponseBody = {
            statistics: {
                type: "article_statistics",
                views: 1,
                conversions: 1,
                reactions: 1,
                happy_reaction_percentage: 1.1,
                neutral_reaction_percentage: 1.1,
                sad_reaction_percentage: 1.1,
            },
            type: "article",
            id: "id",
            workspace_id: "workspace_id",
            title: "title",
            description: "description",
            body: "body",
            author_id: 1,
            state: "published",
            created_at: 1,
            updated_at: 1,
            url: "url",
            parent_id: 1,
            parent_ids: [1, 1],
            parent_type: "parent_type",
            default_locale: "default_locale",
            translated_content: {
                type: "article_translated_content",
                ar: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                bg: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                bs: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ca: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                cs: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                da: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                de: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                el: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                en: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                es: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                et: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                fi: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                fr: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                he: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                hr: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                hu: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                id: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                it: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ja: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ko: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                lt: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                lv: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                mn: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                nb: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                nl: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                pl: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                pt: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ro: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ru: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                sl: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                sr: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                sv: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                tr: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                vi: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                "pt-BR": {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                "zh-CN": {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                "zh-TW": {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
            },
        };
        server
            .mockEndpoint()
            .post("/articles")
            .jsonBody(rawRequestBody)
            .respondWith()
            .statusCode(200)
            .jsonBody(rawResponseBody)
            .build();

        const response = await client.unstable.articles.createArticle({
            key: "value",
        });
        expect(response).toEqual({
            statistics: {
                type: "article_statistics",
                views: 1,
                conversions: 1,
                reactions: 1,
                happy_reaction_percentage: 1.1,
                neutral_reaction_percentage: 1.1,
                sad_reaction_percentage: 1.1,
            },
            type: "article",
            id: "id",
            workspace_id: "workspace_id",
            title: "title",
            description: "description",
            body: "body",
            author_id: 1,
            state: "published",
            created_at: 1,
            updated_at: 1,
            url: "url",
            parent_id: 1,
            parent_ids: [1, 1],
            parent_type: "parent_type",
            default_locale: "default_locale",
            translated_content: {
                type: "article_translated_content",
                ar: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                bg: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                bs: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ca: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                cs: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                da: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                de: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                el: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                en: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                es: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                et: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                fi: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                fr: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                he: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                hr: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                hu: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                id: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                it: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ja: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ko: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                lt: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                lv: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                mn: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                nb: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                nl: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                pl: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                pt: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ro: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                ru: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                sl: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                sr: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                sv: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                tr: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                vi: {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                "pt-BR": {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                "zh-CN": {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
                "zh-TW": {
                    type: "article_content",
                    title: "title",
                    description: "description",
                    body: "body",
                    author_id: 1,
                    state: "published",
                    created_at: 1,
                    updated_at: 1,
                    url: "url",
                },
            },
        });
    });

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

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

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

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

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

        const rawResponseBody = {
            type: "article",
            id: "45",
            workspace_id: "this_is_an_id74_that_should_be_at_least_4",
            title: "This is the article title",
            description: "",
            body: "",
            author_id: 991267502,
            state: "published",
            created_at: 1734537292,
            updated_at: 1734537292,
            url: "http://help-center.test/myapp-74/en/articles/45-this-is-the-article-title",
            parent_id: 148,
            parent_ids: [18, 19],
            parent_type: "collection",
            default_locale: "en",
            translated_content: {
                type: "article_translated_content",
                ar: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                bg: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                bs: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ca: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                cs: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                da: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                de: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                el: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                en: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                es: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                et: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                fi: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                fr: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                he: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                hr: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                hu: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                id: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                it: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ja: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ko: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                lt: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                lv: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                mn: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                nb: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                nl: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                pl: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                pt: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ro: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ru: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                sl: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                sr: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                sv: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                tr: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                vi: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                "pt-BR": {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                "zh-CN": {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                "zh-TW": {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
            },
            statistics: {
                type: "article_statistics",
                views: 0,
                conversions: 0,
                reactions: 0,
                happy_reaction_percentage: 0,
                neutral_reaction_percentage: 0,
                sad_reaction_percentage: 0,
            },
        };
        server.mockEndpoint().get("/articles/1").respondWith().statusCode(200).jsonBody(rawResponseBody).build();

        const response = await client.unstable.articles.retrieveArticle({
            id: 1,
        });
        expect(response).toEqual({
            type: "article",
            id: "45",
            workspace_id: "this_is_an_id74_that_should_be_at_least_4",
            title: "This is the article title",
            description: "",
            body: "",
            author_id: 991267502,
            state: "published",
            created_at: 1734537292,
            updated_at: 1734537292,
            url: "http://help-center.test/myapp-74/en/articles/45-this-is-the-article-title",
            parent_id: 148,
            parent_ids: [18, 19],
            parent_type: "collection",
            default_locale: "en",
            translated_content: {
                type: "article_translated_content",
                ar: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                bg: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                bs: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ca: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                cs: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                da: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                de: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                el: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                en: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                es: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                et: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                fi: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                fr: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                he: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                hr: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                hu: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                id: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                it: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ja: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ko: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                lt: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                lv: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                mn: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                nb: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                nl: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                pl: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                pt: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ro: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                ru: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                sl: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                sr: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                sv: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                tr: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                vi: {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                "pt-BR": {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                "zh-CN": {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
                "zh-TW": {
                    type: "article_content",
                    title: "How to create a new article",
                    description: "This article will show you how to create a new article.",
                    body: "This is the body of the article.",
                    author_id: 1,
                    state: "published",
                    created_at: 1663597223,
                    updated_at: 1663597260,
                    url: "http://intercom.test/help/en/articles/3-default-language",
                },
            },
            statistics: {
                type: "article_statistics",
                views: 0,
                conversions: 0,
                reactions: 0,
                happy_reaction_percentage: 0,
                neutral_reaction_percentage: 0,
                sad_reaction_percentage: 0,
            },
        });
    });

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

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

        await expect(async () => {
            return await client.unstable.articles.retrieveArticle({
                id: 1,
            });
        }).rejects.toThrow(Intercom.unstable.UnauthorizedError);
    });

    test("retrieveArticle (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("/articles/1").respondWith().statusCode(404).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.unstable.articles.retrieveArticle({
                id: 1,
            });
        }).rejects.toThrow(Intercom.unstable.NotFoundError);
    });

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

        const rawResponseBody = { id: "51", object: "article", deleted: true };
        server.mockEndpoint().delete("/articles/1").respondWith().statusCode(200).jsonBody(rawResponseBody).build();

        const response = await client.unstable.articles.deleteArticle({
            id: 1,
        });
        expect(response).toEqual({
            id: "51",
            object: "article",
            deleted: true,
        });
    });

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

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

        await expect(async () => {
            return await client.unstable.articles.deleteArticle({
                id: 1,
            });
        }).rejects.toThrow(Intercom.unstable.UnauthorizedError);
    });

    test("deleteArticle (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("/articles/1").respondWith().statusCode(404).jsonBody(rawResponseBody).build();

        await expect(async () => {
            return await client.unstable.articles.deleteArticle({
                id: 1,
            });
        }).rejects.toThrow(Intercom.unstable.NotFoundError);
    });

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

        const rawResponseBody = {
            type: "list",
            total_count: 1,
            data: {
                articles: [
                    {
                        type: "article",
                        id: "55",
                        workspace_id: "this_is_an_id92_that_should_be_at_least_4",
                        title: "Title 1",
                        description: "",
                        body: "",
                        author_id: 991267521,
                        state: "draft",
                        created_at: 1734537306,
                        updated_at: 1734537306,
                        url: "http://intercom.test/help/en/articles/3-default-language",
                        parent_ids: [18, 19],
                        parent_type: "collection",
                        default_locale: "en",
                    },
                ],
                highlights: [{ article_id: "123" }],
            },
            pages: {
                type: "pages",
                page: 1,
                next: { per_page: 2, starting_after: "your-cursor-from-response" },
                per_page: 10,
                total_pages: 1,
            },
        };
        server.mockEndpoint().get("/articles/search").respondWith().statusCode(200).jsonBody(rawResponseBody).build();

        const response = await client.unstable.articles.searchArticles({
            phrase: "Getting started",
            state: "published",
            help_center_id: 1,
            highlight: true,
        });
        expect(response).toEqual({
            type: "list",
            total_count: 1,
            data: {
                articles: [
                    {
                        type: "article",
                        id: "55",
                        workspace_id: "this_is_an_id92_that_should_be_at_least_4",
                        title: "Title 1",
                        description: "",
                        body: "",
                        author_id: 991267521,
                        state: "draft",
                        created_at: 1734537306,
                        updated_at: 1734537306,
                        url: "http://intercom.test/help/en/articles/3-default-language",
                        parent_ids: [18, 19],
                        parent_type: "collection",
                        default_locale: "en",
                    },
                ],
                highlights: [
                    {
                        article_id: "123",
                    },
                ],
            },
            pages: {
                type: "pages",
                page: 1,
                next: {
                    per_page: 2,
                    starting_after: "your-cursor-from-response",
                },
                per_page: 10,
                total_pages: 1,
            },
        });
    });

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

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

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