- Test that initMobileMenu and initTabs are called on DOMContentLoaded Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
730 B
JavaScript
27 lines
730 B
JavaScript
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
|
|
vi.mock('../../assets/modules/mobile-menu.js', () => ({
|
|
initMobileMenu: vi.fn(),
|
|
}))
|
|
|
|
vi.mock('../../assets/modules/tabs.js', () => ({
|
|
initTabs: vi.fn(),
|
|
}))
|
|
|
|
import { initMobileMenu } from '../../assets/modules/mobile-menu.js'
|
|
import { initTabs } from '../../assets/modules/tabs.js'
|
|
|
|
describe('app.js', () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks()
|
|
})
|
|
|
|
it('calls initMobileMenu and initTabs on DOMContentLoaded', async () => {
|
|
await import('../../assets/app.js')
|
|
document.dispatchEvent(new Event('DOMContentLoaded'))
|
|
|
|
expect(initMobileMenu).toHaveBeenCalled()
|
|
expect(initTabs).toHaveBeenCalled()
|
|
})
|
|
})
|