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
+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|手动粘贴/)
})
})