Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
frankyhollywood committed Aug 12, 2024
1 parent f5ab029 commit 7f30638
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
45 changes: 26 additions & 19 deletions projects/mercury/src/layout/__tests__/MainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,43 @@ import ServicesContext from '../../common/contexts/ServicesContext';
import UserContext from '../../users/UserContext';
import ExternalStoragesContext from '../../external-storage/ExternalStoragesContext';
import ExternalMetadataSourceContext from '../../metadata/metadata-sources/ExternalMetadataSourceContext';
import FeaturesContext from '../../common/contexts/FeaturesContext';
import InternalMetadataSourceContext from '../../metadata/metadata-sources/InternalMetadataSourceContext';
import MetadataViewContext from '../../metadata/views/MetadataViewContext';
import MainMenu from '../MainMenu';
import {DEFAULT_METADATA_VIEW_MENU_LABEL} from '../../constants';
import theme from '../../App.theme';

const mockFeatureContext = {
isFeatureEnabled: jest.fn()
};

describe('MainMenu', () => {
const setup = (user, services, externalStorages, externalMetadataSources, internalMetadata, views) => {
return render(
<ThemeProvider theme={theme}>
<Router>
<ServicesContext.Provider value={{services}}>
<UserContext.Provider value={{currentUser: user}}>
<ExternalStoragesContext.Provider value={{externalStorages}}>
<ExternalMetadataSourceContext.Provider value={{externalMetadataSources}}>
<InternalMetadataSourceContext.Provider
value={{
internalMetadataIcon: internalMetadata.icon,
internalMetadataLabel:
internalMetadata.label || DEFAULT_METADATA_VIEW_MENU_LABEL
}}
>
<MetadataViewContext.Provider value={{views}}>
<MainMenu open />
</MetadataViewContext.Provider>
</InternalMetadataSourceContext.Provider>
</ExternalMetadataSourceContext.Provider>
</ExternalStoragesContext.Provider>
</UserContext.Provider>
</ServicesContext.Provider>
<FeaturesContext.Provider value={mockFeatureContext}>
<ServicesContext.Provider value={{services}}>
<UserContext.Provider value={{currentUser: user}}>
<ExternalStoragesContext.Provider value={{externalStorages}}>
<ExternalMetadataSourceContext.Provider value={{externalMetadataSources}}>
<InternalMetadataSourceContext.Provider
value={{
internalMetadataIcon: internalMetadata.icon,
internalMetadataLabel:
internalMetadata.label || DEFAULT_METADATA_VIEW_MENU_LABEL
}}
>
<MetadataViewContext.Provider value={{views}}>
<MainMenu open />
</MetadataViewContext.Provider>
</InternalMetadataSourceContext.Provider>
</ExternalMetadataSourceContext.Provider>
</ExternalStoragesContext.Provider>
</UserContext.Provider>
</ServicesContext.Provider>
</FeaturesContext.Provider>
</Router>
</ThemeProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.util.stream.Collectors;

import lombok.extern.log4j.*;
import io.fairspace.saturn.services.llm.LlmConversation;
import org.json.JSONObject;
import spark.Request;

Expand Down

0 comments on commit 7f30638

Please sign in to comment.