File size: 919 Bytes
dc649b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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();
  });
});