import React from "react" import { Embed, EmbedAuthor, EmbedField, EmbedFooter, EmbedImage, EmbedThumbnail, EmbedTitle, Reacord, TestAdapter, TestCommandInteraction, } from "../library/main" import { assertMessages } from "./assert-messages" const adapter = new TestAdapter() const reacord = new Reacord({ adapter }) const reply = reacord.createCommandReply(new TestCommandInteraction(adapter)) test("kitchen sink", async () => { const now = new Date() reply.render( <> title text description text , ) await assertMessages(adapter, [ { 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 () => { reply.render( <> author name , ) await assertMessages(adapter, [ { 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 () => { reply.render( <> field value , ) await assertMessages(adapter, [ { 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() reply.render( <> footer text , ) await assertMessages(adapter, [ { 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() reply.render( , ) await assertMessages(adapter, [ { 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" }, ], }, ], }, ]) })