11import { render } from '@testing-library/react'
22import React from 'react'
3- import { describe , expect , it , vi } from 'vitest'
4- import { Layout , Spinner , cn } from '../../src/index.js'
5-
6- vi . mock ( 'next-auth/react' , ( ) => ( { signOut : vi . fn ( ) , useSession : vi . fn ( ) } ) )
7- vi . mock ( 'next/link' , ( ) => ( { default : vi . fn ( ) } ) )
3+ import { describe , expect , it } from 'vitest'
4+ import { Layout } from '../../src/index.js'
85
96describe ( 'Layout Component' , ( ) => {
107 it ( 'renders children' , ( ) => {
@@ -29,29 +26,3 @@ describe('Layout Component', () => {
2926 expect ( getByText ( 'Error: Test Error' ) ) . toBeDefined ( )
3027 } )
3128} )
32-
33- describe ( 'Classname function' , ( ) => {
34- it ( 'joins class names correctly' , ( ) => {
35- expect ( cn ( 'class1' , 'class2' ) ) . toBe ( 'class1 class2' )
36- } )
37-
38- it ( 'ignores undefined and false values' , ( ) => {
39- expect ( cn ( 'class1' , undefined , 'class2' , false ) ) . toBe ( 'class1 class2' )
40- } )
41-
42- it ( 'returns empty string if no valid class names' , ( ) => {
43- expect ( cn ( undefined , false ) ) . toBe ( '' )
44- } )
45-
46- it ( 'handles single class name' , ( ) => {
47- expect ( cn ( 'class1' ) ) . toBe ( 'class1' )
48- } )
49- } )
50-
51- describe ( 'Spinner Component' , ( ) => {
52- it ( 'renders with base and additional class names' , ( ) => {
53- const { container } = render ( < Spinner className = "extra" /> )
54- expect ( container . firstElementChild ?. classList ) . toContain ( 'spinner' )
55- expect ( container . firstElementChild ?. classList ) . toContain ( 'extra' )
56- } )
57- } )
0 commit comments