From e1d9ecfd666d58098757c06423d6b5d0972a5872 Mon Sep 17 00:00:00 2001 From: sunlei Date: Fri, 24 Jul 2026 16:51:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E6=B5=8B=E8=AF=95=E7=B1=BB=E5=9E=8B=E6=A3=80?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/router/routes/modules/qqbot.spec.ts | 10 ++++----- .../MessageSubscriptionModal.spec.tsx | 22 +++++++++++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/apps/web-antdv-next/src/router/routes/modules/qqbot.spec.ts b/apps/web-antdv-next/src/router/routes/modules/qqbot.spec.ts index 4819ffc..4d7beb2 100644 --- a/apps/web-antdv-next/src/router/routes/modules/qqbot.spec.ts +++ b/apps/web-antdv-next/src/router/routes/modules/qqbot.spec.ts @@ -150,11 +150,11 @@ function getAllMessagePushRoutes(sourceFile: ts.SourceFile) { /** Visits route objects so nested copies cannot evade the direct-child assertion. */ function visit(node: ts.Node): void { - if ( - ts.isObjectLiteralExpression(node) && - routeNames.has(getStringProperty(node, 'name')) - ) { - matches.push(node); + if (ts.isObjectLiteralExpression(node)) { + const routeName = getStringProperty(node, 'name'); + if (typeof routeName === 'string' && routeNames.has(routeName)) { + matches.push(node); + } } ts.forEachChild(node, visit); diff --git a/apps/web-antdv-next/src/views/qqbot/message-subscription/components/MessageSubscriptionModal.spec.tsx b/apps/web-antdv-next/src/views/qqbot/message-subscription/components/MessageSubscriptionModal.spec.tsx index 2548883..6afad03 100644 --- a/apps/web-antdv-next/src/views/qqbot/message-subscription/components/MessageSubscriptionModal.spec.tsx +++ b/apps/web-antdv-next/src/views/qqbot/message-subscription/components/MessageSubscriptionModal.spec.tsx @@ -11,6 +11,15 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import MessageSubscriptionModal from './MessageSubscriptionModal'; +type MessageSubscriptionFormPatch = Partial<{ + ddnsRecordId: string | undefined; + enabled: boolean; + name: string; + portForwardId: string | undefined; + remark: string | undefined; + sourceKey: string; +}>; + const mocks = vi.hoisted(() => { const modalApi = { close: vi.fn(async () => {}), @@ -24,7 +33,7 @@ const mocks = vi.hoisted(() => { getValues: vi.fn(), resetForm: vi.fn(async () => {}), resetValidate: vi.fn(async () => {}), - setValues: vi.fn(async () => {}), + setValues: vi.fn(async (_patch: MessageSubscriptionFormPatch) => {}), validate: vi.fn(async () => ({ valid: true })), }; return { @@ -424,9 +433,14 @@ describe('message subscription modal', () => { expect(mocks.modalApi.close).toHaveBeenCalledOnce(); expect(wrapper.emitted('saved')).toHaveLength(1); expect(mocks.modalApi.unlock).toHaveBeenCalledOnce(); - expect(mocks.modalApi.lock.mock.invocationCallOrder[0]).toBeLessThan( - mocks.create.mock.invocationCallOrder[0], - ); + const lockOrder = mocks.modalApi.lock.mock.invocationCallOrder[0]; + const createOrder = mocks.create.mock.invocationCallOrder[0]; + expect(lockOrder).toBeDefined(); + expect(createOrder).toBeDefined(); + if (lockOrder === undefined || createOrder === undefined) { + throw new Error('expected lock and create invocation order values'); + } + expect(lockOrder).toBeLessThan(createOrder); }); it('keeps the modal usable and emits nothing after a rejected mutation', async () => {