🎨 Simplify import formatting and improve code readability in unit tests for GamemasterExplorer component
This commit is contained in:
@@ -105,9 +105,8 @@ describe('GamemasterExplorer', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('shows loading state when isLoading is true', async () => {
|
it('shows loading state when isLoading is true', async () => {
|
||||||
const { useGamemasterFiles } = await import(
|
const { useGamemasterFiles } =
|
||||||
'../../../src/composables/useGamemasterFiles.js'
|
await import('../../../src/composables/useGamemasterFiles.js');
|
||||||
);
|
|
||||||
useGamemasterFiles.mockReturnValueOnce({
|
useGamemasterFiles.mockReturnValueOnce({
|
||||||
selectedFile: ref(''),
|
selectedFile: ref(''),
|
||||||
fileContent: ref(''),
|
fileContent: ref(''),
|
||||||
@@ -127,9 +126,8 @@ describe('GamemasterExplorer', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('shows error state when fileError exists', async () => {
|
it('shows error state when fileError exists', async () => {
|
||||||
const { useGamemasterFiles } = await import(
|
const { useGamemasterFiles } =
|
||||||
'../../../src/composables/useGamemasterFiles.js'
|
await import('../../../src/composables/useGamemasterFiles.js');
|
||||||
);
|
|
||||||
useGamemasterFiles.mockReturnValueOnce({
|
useGamemasterFiles.mockReturnValueOnce({
|
||||||
selectedFile: ref(''),
|
selectedFile: ref(''),
|
||||||
fileContent: ref(''),
|
fileContent: ref(''),
|
||||||
@@ -149,9 +147,8 @@ describe('GamemasterExplorer', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('shows no files state when hasFiles is false', async () => {
|
it('shows no files state when hasFiles is false', async () => {
|
||||||
const { useGamemasterFiles } = await import(
|
const { useGamemasterFiles } =
|
||||||
'../../../src/composables/useGamemasterFiles.js'
|
await import('../../../src/composables/useGamemasterFiles.js');
|
||||||
);
|
|
||||||
useGamemasterFiles.mockReturnValueOnce({
|
useGamemasterFiles.mockReturnValueOnce({
|
||||||
selectedFile: ref(''),
|
selectedFile: ref(''),
|
||||||
fileContent: ref(''),
|
fileContent: ref(''),
|
||||||
@@ -193,7 +190,9 @@ describe('GamemasterExplorer', () => {
|
|||||||
expect(wrapper.findComponent({ name: 'JsonViewer' }).exists()).toBe(true);
|
expect(wrapper.findComponent({ name: 'JsonViewer' }).exists()).toBe(true);
|
||||||
|
|
||||||
// Check for ActionToolbar component
|
// Check for ActionToolbar component
|
||||||
expect(wrapper.findComponent({ name: 'ActionToolbar' }).exists()).toBe(true);
|
expect(wrapper.findComponent({ name: 'ActionToolbar' }).exists()).toBe(
|
||||||
|
true
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('toggles help panel', async () => {
|
it('toggles help panel', async () => {
|
||||||
@@ -231,9 +230,8 @@ describe('GamemasterExplorer', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('calls loadStatus on mount', async () => {
|
it('calls loadStatus on mount', async () => {
|
||||||
const { useGamemasterFiles } = await import(
|
const { useGamemasterFiles } =
|
||||||
'../../../src/composables/useGamemasterFiles.js'
|
await import('../../../src/composables/useGamemasterFiles.js');
|
||||||
);
|
|
||||||
const mockLoadStatus = vi.fn();
|
const mockLoadStatus = vi.fn();
|
||||||
useGamemasterFiles.mockReturnValueOnce({
|
useGamemasterFiles.mockReturnValueOnce({
|
||||||
selectedFile: ref(''),
|
selectedFile: ref(''),
|
||||||
@@ -263,9 +261,8 @@ describe('GamemasterExplorer', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('displays toast messages for clipboard operations', async () => {
|
it('displays toast messages for clipboard operations', async () => {
|
||||||
const { useClipboard } = await import(
|
const { useClipboard } =
|
||||||
'../../../src/composables/useClipboard.js'
|
await import('../../../src/composables/useClipboard.js');
|
||||||
);
|
|
||||||
useClipboard.mockReturnValueOnce({
|
useClipboard.mockReturnValueOnce({
|
||||||
copied: ref(true),
|
copied: ref(true),
|
||||||
error: ref(null),
|
error: ref(null),
|
||||||
|
|||||||
Reference in New Issue
Block a user