Skip to content

Commit

Permalink
fix test code
Browse files Browse the repository at this point in the history
  • Loading branch information
coulsontl committed May 19, 2024
1 parent 2217644 commit 725a1de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/features/User/__tests__/useMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { act, renderHook } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';

import { useUserStore } from '@/store/user';
import { ServerConfigStoreProvider } from '@/store/serverConfig';

import { useMenu } from '../UserPanel/useMenu';

Expand Down Expand Up @@ -69,7 +70,7 @@ describe('useMenu', () => {
enableAuth = true;
enableClerk = false;

const { result } = renderHook(() => useMenu());
const { result } = renderHook(() => useMenu(), { wrapper: ({children})=> <ServerConfigStoreProvider>{children}</ServerConfigStoreProvider> });

act(() => {
const { mainItems, logoutItems } = result.current;
Expand All @@ -89,7 +90,7 @@ describe('useMenu', () => {
enableAuth = true;
enableClerk = true;

const { result } = renderHook(() => useMenu());
const { result } = renderHook(() => useMenu(), { wrapper: ({children})=> <ServerConfigStoreProvider>{children}</ServerConfigStoreProvider> });

act(() => {
const { mainItems, logoutItems } = result.current;
Expand All @@ -108,7 +109,7 @@ describe('useMenu', () => {
});
enableAuth = false;

const { result } = renderHook(() => useMenu());
const { result } = renderHook(() => useMenu(), { wrapper: ({children})=> <ServerConfigStoreProvider>{children}</ServerConfigStoreProvider> });

act(() => {
const { mainItems, logoutItems } = result.current;
Expand All @@ -127,7 +128,7 @@ describe('useMenu', () => {
});
enableAuth = true;

const { result } = renderHook(() => useMenu());
const { result } = renderHook(() => useMenu(), { wrapper: ({children})=> <ServerConfigStoreProvider>{children}</ServerConfigStoreProvider> });

act(() => {
const { mainItems, logoutItems } = result.current;
Expand Down
2 changes: 2 additions & 0 deletions src/store/serverConfig/selectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ describe('featureFlagsSelectors', () => {
showLLM: false,
showOpenAIApiKey: true,
showOpenAIProxyUrl: true,
enableCheckUpdates: true,
showWelcomeSuggest: true,
});
});
});
Expand Down

0 comments on commit 725a1de

Please sign in to comment.