Skip to content

Commit

Permalink
Merge branch 'develop-postgres' of https://github.com/hustlernik/tala…
Browse files Browse the repository at this point in the history
…wa-admin into refactor-issue#2895
  • Loading branch information
hustlernik committed Dec 26, 2024
2 parents f274c04 + c1d2e5f commit 0408dff
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 39 deletions.
24 changes: 0 additions & 24 deletions src/components/AddOn/core/AddOnEntry/AddOnEntry.module.css

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
Expand Up @@ -4,7 +4,6 @@ import type { RenderResult } from '@testing-library/react';
import { render, screen, fireEvent } from '@testing-library/react';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
import 'jest-location-mock';
import { I18nextProvider } from 'react-i18next';

import type { InterfaceVenueModalProps } from './VenueModal';
Expand All @@ -19,6 +18,8 @@ import {
UPDATE_VENUE_MUTATION,
} from 'GraphQl/Mutations/mutations';
import type { ApolloLink } from '@apollo/client';
import { vi } from 'vitest';
import type * as RouterTypes from 'react-router-dom';

const MOCKS = [
{
Expand Down Expand Up @@ -65,10 +66,16 @@ const MOCKS = [
const link = new StaticMockLink(MOCKS, true);

const mockId = 'orgId';
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useParams: () => ({ orgId: mockId }),
}));

vi.mock('react-router-dom', async () => {
const actual = (await vi.importActual(
'react-router-dom',
)) as typeof RouterTypes;
return {
...actual,
useParams: () => ({ orgId: mockId }),
};
});

async function wait(ms = 100): Promise<void> {
await act(() => {
Expand All @@ -78,26 +85,26 @@ async function wait(ms = 100): Promise<void> {
});
}

jest.mock('react-toastify', () => ({
vi.mock('react-toastify', () => ({
toast: {
success: jest.fn(),
warning: jest.fn(),
error: jest.fn(),
success: vi.fn(),
warning: vi.fn(),
error: vi.fn(),
},
}));

const props: InterfaceVenueModalProps[] = [
{
show: true,
onHide: jest.fn(),
onHide: vi.fn(),
edit: false,
venueData: null,
refetchVenues: jest.fn(),
refetchVenues: vi.fn(),
orgId: 'orgId',
},
{
show: true,
onHide: jest.fn(),
onHide: vi.fn(),
edit: true,
venueData: {
_id: 'venue1',
Expand All @@ -106,7 +113,7 @@ const props: InterfaceVenueModalProps[] = [
image: 'image1',
capacity: '100',
},
refetchVenues: jest.fn(),
refetchVenues: vi.fn(),
orgId: 'orgId',
},
];
Expand All @@ -129,7 +136,7 @@ const renderVenueModal = (
};

describe('VenueModal', () => {
global.alert = jest.fn();
global.alert = vi.fn();

test('renders correctly when show is true', async () => {
renderVenueModal(props[0], link);
Expand Down
27 changes: 27 additions & 0 deletions src/style/app.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,33 @@ button[data-testid='createPostBtn'] {
}
}

/* AddOnEntry.tsx */

.entrytoggle {
margin: 24px 24px 0 auto;
width: fit-content;
}

.entryaction {
margin-left: auto;
display: flex !important;
align-items: center;
background-color: transparent;
color: #31bb6b;
}
.cardAddOnEntry {
border: 4px solid green;
}
.entryaction i {
margin-right: 8px;
}

.entryaction .spinner-grow {
height: 1rem;
width: 1rem;
margin-right: 8px;
}

/* PostCard.tsx */

.cardStyles {
Expand Down

0 comments on commit 0408dff

Please sign in to comment.