Files
lucia-frontend/tests/stores/loading.test.js
2026-03-06 18:57:58 +08:00

33 lines
809 B
JavaScript

// The Lucia project.
// Copyright 2026-2026 DSP, inc. All rights reserved.
// Authors:
// imacat.yang@dsp.im (imacat), 2026/03/05
import { describe, it, expect, beforeEach } from 'vitest';
import { setActivePinia, createPinia } from 'pinia';
import { useLoadingStore } from '@/stores/loading';
describe('loadingStore', () => {
let store;
beforeEach(() => {
setActivePinia(createPinia());
store = useLoadingStore();
});
it('has isLoading true by default', () => {
expect(store.isLoading).toBe(true);
});
it('setIsLoading sets to false', () => {
store.setIsLoading(false);
expect(store.isLoading).toBe(false);
});
it('setIsLoading sets to true', () => {
store.setIsLoading(false);
store.setIsLoading(true);
expect(store.isLoading).toBe(true);
});
});