Download packages/stores/src/modules/lock.test.ts from binhugg3/admin: direct link, hf CLI and curl.
- Browser
- Download file 919 Bytes
-
https://huggingface.co/spaces/binhugg3/admin/resolve/main/packages/stores/src/modules/lock.test.ts
- Command line
-
hf download hf://spaces/binhugg3/admin/packages/stores/src/modules/lock.test.ts
-
curl -L -o lock.test.ts https://huggingface.co/spaces/binhugg3/admin/resolve/main/packages/stores/src/modules/lock.test.ts
919 Bytes
| import { createPinia, setActivePinia } from 'pinia'; | |
| import { beforeEach, describe, expect, it } from 'vitest'; | |
| import { useLockStore } from './lock'; | |
| describe('useLockStore', () => { | |
| beforeEach(() => { | |
| setActivePinia(createPinia()); | |
| }); | |
| it('should initialize with correct default state', () => { | |
| const store = useLockStore(); | |
| expect(store.isLockScreen).toBe(false); | |
| expect(store.lockScreenPassword).toBeUndefined(); | |
| }); | |
| it('should lock screen with a password', () => { | |
| const store = useLockStore(); | |
| store.lockScreen('1234'); | |
| expect(store.isLockScreen).toBe(true); | |
| expect(store.lockScreenPassword).toBe('1234'); | |
| }); | |
| it('should unlock screen and clear password', () => { | |
| const store = useLockStore(); | |
| store.lockScreen('1234'); | |
| store.unlockScreen(); | |
| expect(store.isLockScreen).toBe(false); | |
| expect(store.lockScreenPassword).toBeUndefined(); | |
| }); | |
| }); | |