Skip to content

Song/feat/engine link test#3679

Merged
song-xiao-lin merged 5 commits intomasterfrom
song/feat/engineLinkTest
May 9, 2026
Merged

Song/feat/engine link test#3679
song-xiao-lin merged 5 commits intomasterfrom
song/feat/engineLinkTest

Conversation

@song-xiao-lin
Copy link
Copy Markdown
Contributor

No description provided.

@song-xiao-lin song-xiao-lin added the need more test 需要更多的测试 label May 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

PR CI 汇总

状态:全部通过

  • ✅ i18n(zh/en)
  • ✅ ESLint(renderer src/main)
  • ✅ TypeScript(renderer src/main)
  • ✅ ESLint(engine-link-startup)
  • ✅ TypeScript(engine-link-startup)
  • ✅ 图片/视频体积
  • ✅ Vitest(main / renderer / engine-link;test 同目录·别名·相对路径)
  • ✅ Prettier

由 pull_request test workflow 自动生成

@song-xiao-lin song-xiao-lin force-pushed the song/feat/engineLinkTest branch from 20339a6 to b669b40 Compare May 8, 2026 03:18
@01XoX10 01XoX10 added ready and removed need more test 需要更多的测试 labels May 8, 2026
@luoluoTH luoluoTH requested a review from Copilot May 9, 2026 02:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors parts of the engine-link startup flow/UI while adding Vitest coverage for key startup components.

Changes:

  • Centralized the draggable header height into a shared DragHeaderHeight constant and applied it across draggable modals and the startup header.
  • Extracted “safe” yakit status handling into a reusable useYakitStatus hook and adjusted startup linking flow timing/log reset behavior.
  • Added new Vitest test suites for LocalEngine and YaklangEngineWatchDog, and removed the unused HelpDoc component.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
app/renderer/engine-link-startup/vitest.config.ts Tweaks @ alias resolution for the engine-link startup test/build environment.
app/renderer/engine-link-startup/src/pages/StartupPage/utils.ts Adds DragHeaderHeight constant used across startup UI.
app/renderer/engine-link-startup/src/pages/StartupPage/index.tsx Switches to useYakitStatus, refactors link-mode switching timing, and applies draggable header height inline.
app/renderer/engine-link-startup/src/pages/StartupPage/index.module.scss Removes hardcoded header height to defer to the new shared constant via inline style.
app/renderer/engine-link-startup/src/pages/StartupPage/components/YaklangEngineWatchDog/test/index.test.tsx Adds tests for watchdog connection/autostart/keepalive behavior.
app/renderer/engine-link-startup/src/pages/StartupPage/components/YakitLoading/index.tsx Refactors status checks into arrays/memos and simplifies conditional rendering logic.
app/renderer/engine-link-startup/src/pages/StartupPage/components/QuestionModal/index.tsx Uses DragHeaderHeight for draggable bounds instead of a magic number.
app/renderer/engine-link-startup/src/pages/StartupPage/components/LocalEngine/index.tsx Removes unused outputToWelcomeConsole import.
app/renderer/engine-link-startup/src/pages/StartupPage/components/LocalEngine/test/index.test.tsx Adds extensive tests for LocalEngine pre-check/version-check/flow behavior.
app/renderer/engine-link-startup/src/pages/StartupPage/components/HelpDoc/index.tsx Removes HelpDoc component implementation.
app/renderer/engine-link-startup/src/pages/StartupPage/components/HelpDoc/HelpDoc.module.scss Removes styles for the deleted HelpDoc component.
app/renderer/engine-link-startup/src/pages/StartupPage/components/DownloadYaklang/index.tsx Uses DragHeaderHeight for draggable bounds.
app/renderer/engine-link-startup/src/pages/StartupPage/components/AgreementContentModal/index.tsx Uses DragHeaderHeight for draggable bounds.
app/renderer/engine-link-startup/src/hooks/useYakitStatus.ts Introduces useYakitStatus hook to centralize safe status updates.

Comment on lines +1 to +5
import { useMemoizedFn } from 'ahooks'
import useGetSetState from './useGetSetState'
import { YakitStatusType } from '@/pages/StartupPage/types'

export const useYakitStatus = (breakHandleRef: React.MutableRefObject<boolean>) => {
Comment on lines +111 to +115
;(yakitEngine.onStartUpEngineMessage as any).mockReturnValue(() => {})

systemInfoDevSpy = vi.spyOn(SystemInfo, 'isDev', 'get')
isEnpriTraceAgentSpy = vi.spyOn({ isEnpriTraceAgent }, 'isEnpriTraceAgent')
isCommunityYakitSpy = vi.spyOn({ isCommunityYakit }, 'isCommunityYakit')
Comment on lines +113 to +116
systemInfoDevSpy = vi.spyOn(SystemInfo, 'isDev', 'get')
isEnpriTraceAgentSpy = vi.spyOn({ isEnpriTraceAgent }, 'isEnpriTraceAgent')
isCommunityYakitSpy = vi.spyOn({ isCommunityYakit }, 'isCommunityYakit')
})
@song-xiao-lin song-xiao-lin merged commit 0cc859b into master May 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants