mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
fix: test
This commit is contained in:
parent
a82a03feda
commit
f54229ea50
@ -14,7 +14,7 @@ describe('usePreloading', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks()
|
vi.clearAllMocks()
|
||||||
// Mock Audio constructor
|
// Mock Audio constructor
|
||||||
global.Audio = vi.fn().mockImplementation(function() {
|
global.Audio = vi.fn().mockImplementation(function () {
|
||||||
this.src = ''
|
this.src = ''
|
||||||
this.addEventListener = vi.fn()
|
this.addEventListener = vi.fn()
|
||||||
})
|
})
|
||||||
@ -119,7 +119,7 @@ describe('usePreloading', () => {
|
|||||||
it('should handle audio load errors gracefully', () => {
|
it('should handle audio load errors gracefully', () => {
|
||||||
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||||
|
|
||||||
global.Audio = vi.fn().mockImplementation(function() {
|
global.Audio = vi.fn().mockImplementation(function () {
|
||||||
this.src = ''
|
this.src = ''
|
||||||
this.addEventListener = vi.fn((event, callback) => {
|
this.addEventListener = vi.fn((event, callback) => {
|
||||||
if (event === 'error') {
|
if (event === 'error') {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ describe('useReplayGain', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks()
|
vi.clearAllMocks()
|
||||||
// Mock Web Audio API
|
// Mock Web Audio API
|
||||||
global.AudioContext = vi.fn().mockImplementation(function() {
|
global.AudioContext = vi.fn().mockImplementation(function () {
|
||||||
this.createMediaElementSource = vi.fn(() => ({
|
this.createMediaElementSource = vi.fn(() => ({
|
||||||
connect: vi.fn(),
|
connect: vi.fn(),
|
||||||
}))
|
}))
|
||||||
@ -85,7 +85,7 @@ describe('useReplayGain', () => {
|
|||||||
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||||
|
|
||||||
// Mock AudioContext to throw error
|
// Mock AudioContext to throw error
|
||||||
global.AudioContext = vi.fn().mockImplementation(function() {
|
global.AudioContext = vi.fn().mockImplementation(function () {
|
||||||
throw new Error('Web Audio API not supported')
|
throw new Error('Web Audio API not supported')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ describe('useReplayGain', () => {
|
|||||||
connect: vi.fn(),
|
connect: vi.fn(),
|
||||||
}
|
}
|
||||||
|
|
||||||
global.AudioContext = vi.fn().mockImplementation(function() {
|
global.AudioContext = vi.fn().mockImplementation(function () {
|
||||||
this.createMediaElementSource = vi.fn(() => ({
|
this.createMediaElementSource = vi.fn(() => ({
|
||||||
connect: vi.fn(),
|
connect: vi.fn(),
|
||||||
}))
|
}))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user