add channel renderer + try to simplify adapter generics

This commit is contained in:
MapleLeaf
2021-12-27 19:22:21 -06:00
parent 6bfb1ab6de
commit 3682f67bfe
13 changed files with 143 additions and 43 deletions

View File

@@ -0,0 +1,2 @@
test.todo("channel message renderer")
export {}

View File

@@ -6,7 +6,7 @@ import { setupReacordTesting } from "./setup-testing"
test("rendering behavior", async () => {
const { reacord, adapter, assertMessages } = setupReacordTesting()
const reply = reacord.createCommandReply(new TestCommandInteraction(adapter))
const reply = reacord.reply(new TestCommandInteraction(adapter))
reply.render(<KitchenSinkCounter onDeactivate={() => reply.deactivate()} />)
await assertMessages([
@@ -244,7 +244,7 @@ test("rendering behavior", async () => {
test("delete", async () => {
const { reacord, adapter, assertMessages } = setupReacordTesting()
const reply = reacord.createCommandReply(new TestCommandInteraction(adapter))
const reply = reacord.reply(new TestCommandInteraction(adapter))
reply.render(
<>
some text

View File

@@ -9,9 +9,9 @@ import { TestAdapter, TestCommandInteraction } from "../library/testing"
const nextTickPromise = promisify(nextTick)
export function setupReacordTesting() {
const adapter = new TestAdapter()
const adapter = TestAdapter.create()
const reacord = new Reacord({ adapter })
const reply = reacord.createCommandReply(new TestCommandInteraction(adapter))
const reply = reacord.reply(new TestCommandInteraction(adapter))
async function assertMessages(expected: ReturnType<typeof sampleMessages>) {
await nextTickPromise() // wait for the render to complete