Files
makelore/tests/unit/admin-access.test.ts
inman 22add3f01f
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled
完善客户端模块与工作区能力
2026-08-13 19:51:02 +08:00

29 lines
828 B
TypeScript

import { beforeEach, describe, expect, it } from 'vitest';
import {
isAdminSessionUnlocked,
lockAdminSession,
verifyAdminPassword,
} from '../../electron/main/admin-access';
describe('administrator access', () => {
beforeEach(() => {
lockAdminSession();
});
it('unlocks only with the configured administrator password', () => {
expect(verifyAdminPassword('wrong-password')).toBe(false);
expect(isAdminSessionUnlocked()).toBe(false);
expect(verifyAdminPassword('zhiniankeji666')).toBe(true);
expect(isAdminSessionUnlocked()).toBe(true);
});
it('keeps the unlock in memory and supports explicit locking', () => {
verifyAdminPassword('zhiniankeji666');
expect(isAdminSessionUnlocked()).toBe(true);
lockAdminSession();
expect(isAdminSessionUnlocked()).toBe(false);
});
});