@@ -4,6 +4,7 @@ import { act } from '@testing-library/react';
44import { afterEach , describe , expect , it , vi } from 'vitest' ;
55
66import { useInstrumentVisualization } from '../useInstrumentVisualization' ;
7+ import { toBasicISOString } from '@douglasneuroinformatics/libjs' ;
78
89const mockUseInstrument = vi . hoisted ( ( ) =>
910 vi . fn ( ( ) => ( {
@@ -34,6 +35,8 @@ const mockStore = {
3435 } ) )
3536} ;
3637
38+ const mockBasicIsoString = '2025-04-30' ;
39+
3740const mockUseDownload = vi . fn ( ) ;
3841
3942const mockNotification = {
@@ -79,6 +82,10 @@ vi.mock('@/hooks/useInstrumentRecords', () => ({
7982 useInstrumentRecords : ( ) => mockInstrumentRecords
8083} ) ) ;
8184
85+ vi . mock ( '@douglasneuroinformatics/libjs' , ( ) => ( {
86+ toBasicISOString : vi . fn ( ( ) => mockBasicIsoString )
87+ } ) ) ;
88+
8289describe ( 'useInstrumentVisualization tests' , ( ) => {
8390 afterEach ( ( ) => {
8491 vi . clearAllMocks ( ) ;
@@ -97,6 +104,7 @@ describe('useInstrumentVisualization tests', () => {
97104 const [ filename , getContentFn ] = mockUseDownload . mock . calls [ 0 ] ;
98105 expect ( filename ) . toContain ( '.csv' ) ;
99106 const csvContents = getContentFn ( ) ;
107+ expect ( csvContents ) . toMatch ( 'subjectId,Date,someValue\r\ntestId,2025-04-30,abc' ) ;
100108 } ) ;
101109 } ) ;
102110} ) ;
0 commit comments