Fix lint issues in tests

This commit is contained in:
Mert Uyanık
2025-10-29 13:13:47 +03:00
parent bad1cc6ca0
commit 044183cd61
2 changed files with 8 additions and 9 deletions
+1 -2
View File
@@ -1,6 +1,5 @@
import { describe, it, expect, vi } from 'vitest'; import { describe, it, expect, vi } from 'vitest';
import { render, screen, waitFor } from '@testing-library/react'; import { render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { VideoPlayer } from './VideoPlayer'; import { VideoPlayer } from './VideoPlayer';
describe('VideoPlayer', () => { describe('VideoPlayer', () => {
+7 -7
View File
@@ -144,7 +144,7 @@ describe('corsHelper', () => {
describe('checkVideoCORS', () => { describe('checkVideoCORS', () => {
beforeEach(() => { beforeEach(() => {
global.fetch = vi.fn(); globalThis.fetch = vi.fn();
}); });
afterEach(() => { afterEach(() => {
@@ -152,7 +152,7 @@ describe('corsHelper', () => {
}); });
it('returns supported when CORS headers are present', async () => { it('returns supported when CORS headers are present', async () => {
(global.fetch as any).mockResolvedValue({ (globalThis.fetch as any).mockResolvedValue({
ok: true, ok: true,
headers: new Map([ headers: new Map([
['Access-Control-Allow-Origin', '*'], ['Access-Control-Allow-Origin', '*'],
@@ -167,7 +167,7 @@ describe('corsHelper', () => {
}); });
it('returns not supported when CORS headers are missing', async () => { it('returns not supported when CORS headers are missing', async () => {
(global.fetch as any).mockResolvedValue({ (globalThis.fetch as any).mockResolvedValue({
ok: false, ok: false,
headers: new Map(), headers: new Map(),
}); });
@@ -179,7 +179,7 @@ describe('corsHelper', () => {
}); });
it('detects range support', async () => { it('detects range support', async () => {
(global.fetch as any).mockResolvedValue({ (globalThis.fetch as any).mockResolvedValue({
ok: true, ok: true,
headers: new Map([ headers: new Map([
['Access-Control-Allow-Origin', '*'], ['Access-Control-Allow-Origin', '*'],
@@ -192,7 +192,7 @@ describe('corsHelper', () => {
}); });
it('detects no range support when header is "none"', async () => { it('detects no range support when header is "none"', async () => {
(global.fetch as any).mockResolvedValue({ (globalThis.fetch as any).mockResolvedValue({
ok: true, ok: true,
headers: new Map([ headers: new Map([
['Access-Control-Allow-Origin', '*'], ['Access-Control-Allow-Origin', '*'],
@@ -205,7 +205,7 @@ describe('corsHelper', () => {
}); });
it('handles CORS fetch errors', async () => { 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'); const result = await checkVideoCORS('https://example.com/video.mp4');
expect(result.supported).toBe(false); expect(result.supported).toBe(false);
@@ -214,7 +214,7 @@ describe('corsHelper', () => {
}); });
it('handles general fetch errors', async () => { 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'); const result = await checkVideoCORS('https://example.com/video.mp4');
expect(result.supported).toBe(false); expect(result.supported).toBe(false);