11import { describe , it , expect , vi , beforeEach } from 'vitest' ;
2- import { captureConsoleBreadcrumb } from '../../../src/integrations/console' ;
2+ import { addConsoleBreadcrumb } from '../../../src/integrations/console' ;
33import { addBreadcrumb } from '../../../src/breadcrumbs' ;
44
55vi . mock ( '../../../src/breadcrumbs' , ( ) => ( {
66 addBreadcrumb : vi . fn ( ) ,
77} ) ) ;
88
9- describe ( 'captureConsoleBreadcrumb ' , ( ) => {
9+ describe ( 'addConsoleBreadcrumb ' , ( ) => {
1010 beforeEach ( ( ) => {
1111 vi . clearAllMocks ( ) ;
1212 } ) ;
@@ -15,7 +15,7 @@ describe('captureConsoleBreadcrumb', () => {
1515 const level = 'log' ;
1616 const args = [ 'test message' , 123 ] ;
1717
18- captureConsoleBreadcrumb ( level , args ) ;
18+ addConsoleBreadcrumb ( level , args ) ;
1919
2020 expect ( addBreadcrumb ) . toHaveBeenCalledWith (
2121 expect . objectContaining ( {
@@ -34,29 +34,25 @@ describe('captureConsoleBreadcrumb', () => {
3434 ) ;
3535 } ) ;
3636
37- it ( 'handles different console levels correctly' , ( ) => {
38- const levels = [ 'debug' , 'info' , 'warn' , 'error' ] as const ;
39-
40- levels . forEach ( level => {
41- captureConsoleBreadcrumb ( level , [ 'test' ] ) ;
42- expect ( addBreadcrumb ) . toHaveBeenCalledWith (
43- expect . objectContaining ( {
44- level : expect . any ( String ) ,
45- } ) ,
46- expect . any ( Object ) ,
47- ) ;
48- } ) ;
37+ it . each ( [ 'debug' , 'info' , 'warn' , 'error' ] as const ) ( 'handles %s level correctly' , level => {
38+ addConsoleBreadcrumb ( level , [ 'test' ] ) ;
39+ expect ( addBreadcrumb ) . toHaveBeenCalledWith (
40+ expect . objectContaining ( {
41+ level : expect . any ( String ) ,
42+ } ) ,
43+ expect . any ( Object ) ,
44+ ) ;
4945 } ) ;
5046
5147 it ( 'skips breadcrumb for passed assertions' , ( ) => {
52- captureConsoleBreadcrumb ( 'assert' , [ true , 'should not be captured' ] ) ;
48+ addConsoleBreadcrumb ( 'assert' , [ true , 'should not be captured' ] ) ;
5349 expect ( addBreadcrumb ) . not . toHaveBeenCalled ( ) ;
5450 } ) ;
5551
5652 it ( 'creates breadcrumb for failed assertions' , ( ) => {
5753 const args = [ false , 'assertion failed' , 'details' ] ;
5854
59- captureConsoleBreadcrumb ( 'assert' , args ) ;
55+ addConsoleBreadcrumb ( 'assert' , args ) ;
6056
6157 expect ( addBreadcrumb ) . toHaveBeenCalledWith (
6258 expect . objectContaining ( {
0 commit comments