import React from "react" import { Embed, EmbedAuthor, EmbedField, EmbedFooter, EmbedImage, EmbedThumbnail, EmbedTitle, Reacord, } from "../library/main" import { TestAdapter, TestCommandInteraction } from "../library/testing" import { setupReacordTesting } from "./setup-testing" const adapter = new TestAdapter() const reacord = new Reacord({ adapter }) const reply = reacord.createCommandReply(new TestCommandInteraction(adapter)) const { assertRender } = setupReacordTesting() test("kitchen sink", async () => { const now = new Date() await assertRender( <> title text description text , [ { actionRows: [], content: "", embeds: [ { author: { icon_url: "https://example.com/author.png", name: "author", }, color: 0xfe_ee_ef, fields: [ { inline: true, name: "field name", value: "field value", }, { name: "block field", value: "block field value", }, ], footer: { icon_url: "https://example.com/footer.png", text: "footer text", }, image: { url: "https://example.com/image.png", }, thumbnail: { url: "https://example.com/thumbnail.png", }, timestamp: now.toISOString(), title: "title text", }, ], }, ], ) }) test("author variants", async () => { await assertRender( <> author name , [ { content: "", actionRows: [], embeds: [ { author: { icon_url: "https://example.com/author.png", name: "author name", }, }, { author: { icon_url: "https://example.com/author.png", name: "", }, }, ], }, ], ) }) test("field variants", async () => { await assertRender( <> field value , [ { content: "", actionRows: [], embeds: [ { fields: [ { name: "field name", value: "field value", }, { inline: true, name: "field name", value: "field value", }, { inline: true, name: "field name", value: "field value", }, { name: "field name", value: "", }, ], }, ], }, ], ) }) test("footer variants", async () => { const now = new Date() await assertRender( <> footer text , [ { content: "", actionRows: [], embeds: [ { footer: { text: "footer text", }, }, { footer: { icon_url: "https://example.com/footer.png", text: "footer text", }, }, { footer: { text: "footer text", }, timestamp: now.toISOString(), }, { footer: { icon_url: "https://example.com/footer.png", text: "", }, timestamp: now.toISOString(), }, ], }, ], ) }) test("embed props", async () => { const now = new Date() await assertRender( , [ { content: "", actionRows: [], embeds: [ { title: "title text", description: "description text", url: "https://example.com/", color: 0xfe_ee_ef, timestamp: now.toISOString(), author: { name: "author name", url: "https://example.com/author", icon_url: "https://example.com/author.png", }, thumbnail: { url: "https://example.com/thumbnail.png" }, image: { url: "https://example.com/image.png" }, footer: { text: "footer text", icon_url: "https://example.com/footer.png", }, fields: [ { name: "field name", value: "field value", inline: true }, { name: "block field", value: "block field value" }, ], }, ], }, ], ) })