more test fixes
This commit is contained in:
@@ -1,40 +1,48 @@
|
||||
import { test } from "vitest"
|
||||
// import { ReacordTester } from "./test-adapter"
|
||||
import { ButtonStyle, ComponentType } from "discord.js"
|
||||
import React from "react"
|
||||
import { beforeEach, expect, test } from "vitest"
|
||||
import { Link } from "../library/main"
|
||||
import { ReacordTester } from "./tester"
|
||||
|
||||
// const tester = new ReacordTester()
|
||||
|
||||
test.skip("link", async () => {
|
||||
// await tester.assertRender(
|
||||
// <>
|
||||
// <Link url="https://example.com/">link text</Link>
|
||||
// <Link label="link text" url="https://example.com/" />
|
||||
// <Link label="link text" url="https://example.com/" disabled />
|
||||
// </>,
|
||||
// [
|
||||
// {
|
||||
// content: "",
|
||||
// embeds: [],
|
||||
// actionRows: [
|
||||
// [
|
||||
// {
|
||||
// type: "link",
|
||||
// url: "https://example.com/",
|
||||
// label: "link text",
|
||||
// },
|
||||
// {
|
||||
// type: "link",
|
||||
// url: "https://example.com/",
|
||||
// label: "link text",
|
||||
// },
|
||||
// {
|
||||
// type: "link",
|
||||
// url: "https://example.com/",
|
||||
// label: "link text",
|
||||
// disabled: true,
|
||||
// },
|
||||
// ],
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
// )
|
||||
let tester: ReacordTester
|
||||
beforeEach(async () => {
|
||||
tester = await ReacordTester.create()
|
||||
})
|
||||
|
||||
test("link", async () => {
|
||||
const { message } = await tester.render(
|
||||
"link",
|
||||
<>
|
||||
<Link url="https://example.com/">link text</Link>
|
||||
<Link label="link text" url="https://example.com/" />
|
||||
<Link label="link text" url="https://example.com/" disabled />
|
||||
</>,
|
||||
)
|
||||
|
||||
expect(message.components.map((c) => c.toJSON())).toEqual([
|
||||
{
|
||||
type: ComponentType.ActionRow,
|
||||
components: [
|
||||
{
|
||||
type: ComponentType.Button,
|
||||
style: ButtonStyle.Link,
|
||||
url: "https://example.com/",
|
||||
label: "link text",
|
||||
},
|
||||
{
|
||||
type: ComponentType.Button,
|
||||
style: ButtonStyle.Link,
|
||||
url: "https://example.com/",
|
||||
label: "link text",
|
||||
},
|
||||
{
|
||||
type: ComponentType.Button,
|
||||
style: ButtonStyle.Link,
|
||||
url: "https://example.com/",
|
||||
label: "link text",
|
||||
disabled: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user