Merge pull request #7 from MertUyanik/codex/fix-linting-errors-in-tests
Fix lint issues in tests
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { render, waitFor } from '@testing-library/react';
|
||||
import { VideoPlayer } from './VideoPlayer';
|
||||
|
||||
describe('VideoPlayer', () => {
|
||||
|
||||
@@ -144,7 +144,7 @@ describe('corsHelper', () => {
|
||||
|
||||
describe('checkVideoCORS', () => {
|
||||
beforeEach(() => {
|
||||
global.fetch = vi.fn();
|
||||
globalThis.fetch = vi.fn();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -152,7 +152,7 @@ describe('corsHelper', () => {
|
||||
});
|
||||
|
||||
it('returns supported when CORS headers are present', async () => {
|
||||
(global.fetch as any).mockResolvedValue({
|
||||
(globalThis.fetch as any).mockResolvedValue({
|
||||
ok: true,
|
||||
headers: new Map([
|
||||
['Access-Control-Allow-Origin', '*'],
|
||||
@@ -167,7 +167,7 @@ describe('corsHelper', () => {
|
||||
});
|
||||
|
||||
it('returns not supported when CORS headers are missing', async () => {
|
||||
(global.fetch as any).mockResolvedValue({
|
||||
(globalThis.fetch as any).mockResolvedValue({
|
||||
ok: false,
|
||||
headers: new Map(),
|
||||
});
|
||||
@@ -179,7 +179,7 @@ describe('corsHelper', () => {
|
||||
});
|
||||
|
||||
it('detects range support', async () => {
|
||||
(global.fetch as any).mockResolvedValue({
|
||||
(globalThis.fetch as any).mockResolvedValue({
|
||||
ok: true,
|
||||
headers: new Map([
|
||||
['Access-Control-Allow-Origin', '*'],
|
||||
@@ -192,7 +192,7 @@ describe('corsHelper', () => {
|
||||
});
|
||||
|
||||
it('detects no range support when header is "none"', async () => {
|
||||
(global.fetch as any).mockResolvedValue({
|
||||
(globalThis.fetch as any).mockResolvedValue({
|
||||
ok: true,
|
||||
headers: new Map([
|
||||
['Access-Control-Allow-Origin', '*'],
|
||||
@@ -205,7 +205,7 @@ describe('corsHelper', () => {
|
||||
});
|
||||
|
||||
it('handles CORS fetch errors', async () => {
|
||||
(global.fetch as any).mockRejectedValue(new TypeError('Failed to fetch (CORS)'));
|
||||
(globalThis.fetch as any).mockRejectedValue(new TypeError('Failed to fetch (CORS)'));
|
||||
|
||||
const result = await checkVideoCORS('https://example.com/video.mp4');
|
||||
expect(result.supported).toBe(false);
|
||||
@@ -214,7 +214,7 @@ describe('corsHelper', () => {
|
||||
});
|
||||
|
||||
it('handles general fetch errors', async () => {
|
||||
(global.fetch as any).mockRejectedValue(new Error('Network error'));
|
||||
(globalThis.fetch as any).mockRejectedValue(new Error('Network error'));
|
||||
|
||||
const result = await checkVideoCORS('https://example.com/video.mp4');
|
||||
expect(result.supported).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user