tests: Update frontend tests for recent frontend changes (Floating Video Player and Stream Connection Card)
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Frontend Tests / test (push) Waiting to run

This commit is contained in:
SergeantPanda 2026-04-12 12:37:02 -05:00
parent e69a8f3449
commit 298ca3260e
2 changed files with 5 additions and 11 deletions

View file

@ -243,8 +243,9 @@ describe('FloatingVideo', () => {
const { container } = render(<FloatingVideo />);
const video = container.querySelector('video');
// Simulate video loaded event to clear loading state
// Simulate video loaded and canplay events to clear loading state and show overlay
fireEvent.loadedData(video);
fireEvent.canPlay(video);
expect(screen.getAllByText('Test Movie').length).toBeGreaterThanOrEqual(
1

View file

@ -42,7 +42,6 @@ vi.mock('../../../utils/cards/StreamConnectionCardUtils.js', () => ({
getChannelStreams: vi.fn(() => Promise.resolve([])),
getLogoUrl: vi.fn(() => null),
getM3uAccountsMap: vi.fn(() => ({})),
getMatchingStreamByUrl: vi.fn(() => null),
getSelectedStream: vi.fn(() => null),
getStartDate: vi.fn(() => 'Jan 1 2024 10:00 AM'),
getStreamOptions: vi.fn(() => []),
@ -181,7 +180,6 @@ import useVideoStore from '../../../store/useVideoStore';
import { showNotification } from '../../../utils/notificationUtils.js';
import {
getChannelStreams,
getMatchingStreamByUrl,
getSelectedStream,
getStreamsByIds,
switchStream,
@ -628,7 +626,7 @@ describe('StreamConnectionCard', () => {
});
});
it('sets activeStreamId when a matching stream is found by URL', async () => {
it('sets activeStreamId when a matching stream is found by stream_id', async () => {
vi.mocked(getChannelStreams).mockResolvedValue([
{
id: 42,
@ -637,15 +635,10 @@ describe('StreamConnectionCard', () => {
m3u_profile: null,
},
]);
vi.mocked(getMatchingStreamByUrl).mockReturnValue({
id: 42,
name: 'Stream A',
url: 'http://stream.example.com/ch1',
m3u_profile: null,
});
render(<StreamConnectionCard {...defaultProps()} />);
await waitFor(() => {
expect(getMatchingStreamByUrl).toHaveBeenCalled();
// defaultProps channel has stream_id: 42, which matches the stream id above
expect(getChannelStreams).toHaveBeenCalled();
});
});