Skip to content

Commit

Permalink
Merge branch 'develop-postgres' into OrganizationDashCards_tests-migr…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
amaan-aly246 authored Dec 26, 2024
2 parents c17efbf + 0cede94 commit 8ebcb99
Show file tree
Hide file tree
Showing 16 changed files with 168 additions and 389 deletions.
24 changes: 0 additions & 24 deletions src/components/AddOn/core/AddOnEntry/AddOnEntry.module.css

This file was deleted.

236 changes: 0 additions & 236 deletions src/components/AddOn/core/AddOnEntry/AddOnEntry.test.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import styles from './AddOnEntry.module.css';
import styles from './../../../../style/app.module.css';
import { Button, Card, Spinner } from 'react-bootstrap';
import { UPDATE_INSTALL_STATUS_PLUGIN_MUTATION } from 'GraphQl/Mutations/mutations';
import { useMutation } from '@apollo/client';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { act } from 'react';
import 'jest-location-mock';
import { fireEvent, render, screen } from '@testing-library/react';
import {
ApolloClient,
Expand All @@ -20,17 +19,18 @@ import { ORGANIZATIONS_LIST, PLUGIN_GET } from 'GraphQl/Queries/Queries';
import userEvent from '@testing-library/user-event';
import useLocalStorage from 'utils/useLocalstorage';
import { MockedProvider } from '@apollo/react-testing';
import { vi, describe, test, expect } from 'vitest';

const { getItem } = useLocalStorage();
interface InterfacePlugin {
enabled: boolean;
pluginName: string;
component: string;
}
jest.mock('components/AddOn/support/services/Plugin.helper', () => ({
vi.mock('components/AddOn/support/services/Plugin.helper', () => ({
__esModule: true,
default: jest.fn().mockImplementation(() => ({
fetchStore: jest.fn().mockResolvedValue([
default: vi.fn().mockImplementation(() => ({
fetchStore: vi.fn().mockResolvedValue([
{
_id: '1',
pluginName: 'Plugin 1',
Expand All @@ -47,7 +47,7 @@ jest.mock('components/AddOn/support/services/Plugin.helper', () => ({
},
// Add more mock data as needed
]),
fetchInstalled: jest.fn().mockResolvedValue([
fetchInstalled: vi.fn().mockResolvedValue([
{
_id: '1',
pluginName: 'Installed Plugin 1',
Expand All @@ -64,18 +64,16 @@ jest.mock('components/AddOn/support/services/Plugin.helper', () => ({
},
// Add more mock data as needed
]),
generateLinks: jest
.fn()
.mockImplementation((plugins: InterfacePlugin[]) => {
return plugins
.filter((plugin) => plugin.enabled)
.map((installedPlugin) => {
return {
name: installedPlugin.pluginName,
url: `/plugin/${installedPlugin.component.toLowerCase()}`,
};
});
}),
generateLinks: vi.fn().mockImplementation((plugins: InterfacePlugin[]) => {
return plugins
.filter((plugin) => plugin.enabled)
.map((installedPlugin) => {
return {
name: installedPlugin.pluginName,
url: `/plugin/${installedPlugin.component.toLowerCase()}`,
};
});
}),
})),
}));

Expand All @@ -99,11 +97,11 @@ const client: ApolloClient<NormalizedCacheObject> = new ApolloClient({
link: ApolloLink.from([httpLink]),
});

jest.mock('components/AddOn/support/services/Plugin.helper', () => ({
vi.mock('components/AddOn/support/services/Plugin.helper', () => ({
__esModule: true,
default: jest.fn().mockImplementation(() => ({
fetchInstalled: jest.fn().mockResolvedValue([]),
fetchStore: jest.fn().mockResolvedValue([]),
default: vi.fn().mockImplementation(() => ({
fetchInstalled: vi.fn().mockResolvedValue([]),
fetchStore: vi.fn().mockResolvedValue([]),
})),
}));

Expand Down Expand Up @@ -168,10 +166,15 @@ const PLUGIN_LOADING_MOCK = {
loading: true,
},
};
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useParams: () => ({ orgId: 'undefined' }),
}));

vi.mock('react-router-dom', async () => {
const actualModule = await vi.importActual('react-router-dom');
return {
...actualModule,
useParams: () => ({ orgId: 'undefined' }),
};
});

const ORGANIZATIONS_LIST_MOCK = {
request: {
query: ORGANIZATIONS_LIST,
Expand Down
24 changes: 0 additions & 24 deletions src/components/AddOn/support/components/Action/Action.test.tsx

This file was deleted.

Loading

0 comments on commit 8ebcb99

Please sign in to comment.