test(17-01): add JKSessionSettingsModal test file with setup

- Create __tests__ directory for client components
- Add test file with imports and mocks for react-i18next
- Create renderModal helper function with default props
- Add placeholder test verifying setup works
This commit is contained in:
Nuwan 2026-02-08 12:20:04 +05:30
parent 6b4acce615
commit b7cec1ff34
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import JKSessionSettingsModal from '../JKSessionSettingsModal';
import { SESSION_PRIVACY_MAP } from '../../../helpers/globals.js';
// Mock react-i18next (required because component uses useTranslation)
jest.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key) => {
const translations = {
'new.privacy_opt_public': 'Public',
'new.privacy_opt_private_invite': 'Private (Invite Only)',
'new.privacy_opt_private_approve': 'Private (Approval Required)'
};
return translations[key] || key;
}
})
}));
// Helper function for rendering component with default props
const renderModal = (props = {}) => {
const defaultProps = {
isOpen: true,
toggle: jest.fn(),
currentSession: {
privacy: SESSION_PRIVACY_MAP.private_approve,
description: 'Test session description'
},
onSave: jest.fn(),
loading: false
};
return render(<JKSessionSettingsModal {...defaultProps} {...props} />);
};
describe('JKSessionSettingsModal', () => {
// Placeholder test to verify setup
test('renders without crashing', () => {
renderModal();
expect(screen.getByText('Session Settings')).toBeInTheDocument();
});
});