chore: Fix remaining extension test types, enable type checking for extension tests.

This commit is contained in:
cpojer
2026-02-17 10:12:49 +09:00
parent a741985574
commit d3a36cc3b0
10 changed files with 161 additions and 37 deletions

View File

@@ -3,13 +3,21 @@ import { describe, expect, it, vi } from "vitest";
import { ircOnboardingAdapter } from "./onboarding.js";
import type { CoreConfig } from "./types.js";
const selectFirstOption = async <T>(params: { options: Array<{ value: T }> }): Promise<T> => {
const first = params.options[0];
if (!first) {
throw new Error("no options");
}
return first.value;
};
describe("irc onboarding", () => {
it("configures host and nick via onboarding prompts", async () => {
const prompter: WizardPrompter = {
intro: vi.fn(async () => {}),
outro: vi.fn(async () => {}),
note: vi.fn(async () => {}),
select: vi.fn(async () => "allowlist"),
select: selectFirstOption as WizardPrompter["select"],
multiselect: vi.fn(async () => []),
text: vi.fn(async ({ message }: { message: string }) => {
if (message === "IRC server host") {
@@ -50,7 +58,9 @@ describe("irc onboarding", () => {
const runtime: RuntimeEnv = {
log: vi.fn(),
error: vi.fn(),
exit: vi.fn(),
exit: vi.fn((code: number): never => {
throw new Error(`exit ${code}`);
}),
};
const result = await ircOnboardingAdapter.configure({
@@ -78,7 +88,7 @@ describe("irc onboarding", () => {
intro: vi.fn(async () => {}),
outro: vi.fn(async () => {}),
note: vi.fn(async () => {}),
select: vi.fn(async () => "allowlist"),
select: selectFirstOption as WizardPrompter["select"],
multiselect: vi.fn(async () => []),
text: vi.fn(async ({ message }: { message: string }) => {
if (message === "IRC allowFrom (nick or nick!user@host)") {

View File

@@ -127,6 +127,6 @@ describe("irc policy", () => {
groupIdCaseInsensitive: true,
});
expect(sharedDisabled.allowed).toBe(inboundDisabled.allowed);
expect(sharedDisabled.groupConfig?.enabled).toBe(inboundDisabled.groupConfig?.enabled);
expect(inboundDisabled.groupConfig?.enabled).toBe(false);
});
});