fix: 增加sip文案

This commit is contained in:
Wxw-Gu
2026-09-18 09:38:33 +08:00
parent 774346d503
commit 12b8fb34c6
7 changed files with 106 additions and 19 deletions
+3 -1
View File
@@ -143,7 +143,9 @@ describe('DatabaseConnectionPage', () => {
expect(screen.getByRole('button', { name: '开始获取密钥' })).toBeVisible()
expect(screen.queryByText(/管理员授权|电脑密码/)).not.toBeInTheDocument()
expect(screen.queryByText(/Frida|Python|SIP|重新签名/)).not.toBeInTheDocument()
// SIP is a user prerequisite, not an implementation detail: seeing it in the
// UI is expected whenever the key cannot be captured without it.
expect(screen.queryByText(/Frida|Python|重新签名/)).not.toBeInTheDocument()
})
it('renders a discovered nickname and avatar before connection', () => {
@@ -84,7 +84,8 @@ describe('database key controls', () => {
expect(screen.getByText('Intel Mac 自动获取')).toBeVisible()
expect(screen.getByText(/按页面提示操作即可/)).toBeVisible()
expect(screen.queryByText(/Frida|Python|SIP|签名/)).not.toBeInTheDocument()
// SIP is a user prerequisite, not an implementation detail.
expect(screen.queryByText(/Frida|Python|签名/)).not.toBeInTheDocument()
await user.click(screen.getByRole('button', { name: '自动获取密钥' }))
expect(onDetect).toHaveBeenCalledOnce()
})
+27
View File
@@ -7,9 +7,11 @@ vi.mock('electron', () => ({
}))
import {
SIP_ENABLED_ERROR,
buildAppleSiliconXkeyInvocation,
buildXkeyHelperArguments,
mapXkeyHelperFailure,
parseSipEnabled,
parseXkeyHelperOutput,
resolveXkeyHelperMode
} from '../../src/main/key-service-mac'
@@ -133,3 +135,28 @@ describe('parseXkeyHelperOutput', () => {
})
})
})
describe('parseSipEnabled', () => {
it.each<[string, boolean]>([
['System Integrity Protection status: enabled.', true],
['System Integrity Protection status: disabled.', false],
['System Integrity Protection status: unknown (Custom Configuration).', false],
['System Integrity Protection status: enabled (Apple Internal).', true],
['System Integrity Protection status: disabled (Apple Internal).', false]
])('reads "%s" as %s', (statusOutput, expected) => {
expect(parseSipEnabled(statusOutput)).toBe(expected)
})
it('only reads the status field, not the word enabled elsewhere in the output', () => {
expect(
parseSipEnabled('System Integrity Protection status: disabled.\nKernel Extensions: enabled')
).toBe(false)
})
})
describe('SIP blocking message', () => {
it('names the prerequisite and the next action', () => {
expect(SIP_ENABLED_ERROR).toContain('SIP')
expect(SIP_ENABLED_ERROR).toMatch(/关闭 SIP|手动粘贴/)
})
})