Nychthemeron/packages/library/tests/lib.spec.ts
2026-07-15 19:28:29 -04:00

30 lines
1 KiB
TypeScript

import { describe, it, expect, vi } from 'vitest'
import type { App } from 'vue'
import { createNychthemeron, LoadingIcon } from '../src/index'
describe('createNychthemeron', () => {
it('returns a Vue plugin with install method', () => {
const plugin = createNychthemeron()
expect(typeof plugin.install).toBe('function')
})
it('install registers NychButton and NychLoadingIcon globally', () => {
const plugin = createNychthemeron()
const mockApp = { component: vi.fn() } as unknown as App
plugin.install(mockApp)
expect(mockApp.component).toHaveBeenCalledWith('NychButton', expect.anything())
expect(mockApp.component).toHaveBeenCalledWith('NychLoadingIcon', expect.anything())
})
it('exposes Button and LoadingIcon components', () => {
const { Button: btn, LoadingIcon: icon } = createNychthemeron()
expect(btn).toBeDefined()
expect(icon).toBeDefined()
})
})
describe('LoadingIcon', () => {
it('is a valid Vue component', () => {
expect(LoadingIcon).toBeDefined()
})
})