🎨 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 () => {
|
||||
const { useGamemasterFiles } = await import(
|
||||
'../../../src/composables/useGamemasterFiles.js'
|
||||
);
|
||||
const { useGamemasterFiles } =
|
||||
await import('../../../src/composables/useGamemasterFiles.js');
|
||||
useGamemasterFiles.mockReturnValueOnce({
|
||||
selectedFile: ref(''),
|
||||
fileContent: ref(''),
|
||||
@@ -127,9 +126,8 @@ describe('GamemasterExplorer', () => {
|
||||
});
|
||||
|
||||
it('shows error state when fileError exists', async () => {
|
||||
const { useGamemasterFiles } = await import(
|
||||
'../../../src/composables/useGamemasterFiles.js'
|
||||
);
|
||||
const { useGamemasterFiles } =
|
||||
await import('../../../src/composables/useGamemasterFiles.js');
|
||||
useGamemasterFiles.mockReturnValueOnce({
|
||||
selectedFile: ref(''),
|
||||
fileContent: ref(''),
|
||||
@@ -149,9 +147,8 @@ describe('GamemasterExplorer', () => {
|
||||
});
|
||||
|
||||
it('shows no files state when hasFiles is false', async () => {
|
||||
const { useGamemasterFiles } = await import(
|
||||
'../../../src/composables/useGamemasterFiles.js'
|
||||
);
|
||||
const { useGamemasterFiles } =
|
||||
await import('../../../src/composables/useGamemasterFiles.js');
|
||||
useGamemasterFiles.mockReturnValueOnce({
|
||||
selectedFile: ref(''),
|
||||
fileContent: ref(''),
|
||||
@@ -193,7 +190,9 @@ describe('GamemasterExplorer', () => {
|
||||
expect(wrapper.findComponent({ name: 'JsonViewer' }).exists()).toBe(true);
|
||||
|
||||
// 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 () => {
|
||||
@@ -231,9 +230,8 @@ describe('GamemasterExplorer', () => {
|
||||
});
|
||||
|
||||
it('calls loadStatus on mount', async () => {
|
||||
const { useGamemasterFiles } = await import(
|
||||
'../../../src/composables/useGamemasterFiles.js'
|
||||
);
|
||||
const { useGamemasterFiles } =
|
||||
await import('../../../src/composables/useGamemasterFiles.js');
|
||||
const mockLoadStatus = vi.fn();
|
||||
useGamemasterFiles.mockReturnValueOnce({
|
||||
selectedFile: ref(''),
|
||||
@@ -263,9 +261,8 @@ describe('GamemasterExplorer', () => {
|
||||
});
|
||||
|
||||
it('displays toast messages for clipboard operations', async () => {
|
||||
const { useClipboard } = await import(
|
||||
'../../../src/composables/useClipboard.js'
|
||||
);
|
||||
const { useClipboard } =
|
||||
await import('../../../src/composables/useClipboard.js');
|
||||
useClipboard.mockReturnValueOnce({
|
||||
copied: ref(true),
|
||||
error: ref(null),
|
||||
|
||||
Reference in New Issue
Block a user