@@ -125,6 +125,44 @@ describe('NIFTI', function() {
125125 } )
126126 } )
127127
128+ it ( 'should generate warning if files listed in IntendedFor of fieldmap json are not of type .nii or .nii.gz' , function ( ) {
129+ var file = {
130+ name : 'sub-09_ses-test_run-01_fieldmap.nii.gz' ,
131+ path :
132+ '/ds114/sub-09/ses-test/fmap/sub-09_ses-test_run-01_fieldmap.nii.gz' ,
133+ relativePath :
134+ '/sub-09/ses-test/fmap/sub-09_ses-test_run-01_fieldmap.nii.gz' ,
135+ }
136+
137+ var jsonContentsDict = {
138+ '/sub-09/ses-test/fmap/sub-09_ses-test_run-01_fieldmap.json' : {
139+ TaskName : 'Mixed Event Related Probe' ,
140+ IntendedFor : [
141+ 'func/sub-15_task-mixedeventrelatedprobe_run-05_bold.json' ,
142+ 'func/sub-15_task-mixedeventrelatedprobe_run-02_bold.nii.gz' ,
143+ ] ,
144+ } ,
145+ }
146+ var fileList = [ ]
147+ fileList . push ( {
148+ name : 'sub-15_task-mixedeventrelatedprobe_run-01_bold.nii.gz' ,
149+ path : 'sub-15/func/sub-15_task-mixedeventrelatedprobe_run-01_bold.nii.gz' ,
150+ relativePath :
151+ '/func/sub-15_task-mixedeventrelatedprobe_run-01_bold.nii.gz' ,
152+ } )
153+ validate . NIFTI ( null , file , jsonContentsDict , { } , [ ] , [ ] , function ( issues ) {
154+ assert (
155+ issues . some (
156+ issue =>
157+ issue . reason ===
158+ 'Invalid filetype: IntendedFor should point to the .nii[.gz] files.' &&
159+ issue . evidence ===
160+ 'func/sub-15_task-mixedeventrelatedprobe_run-05_bold.json' ,
161+ ) ,
162+ )
163+ } )
164+ } )
165+
128166 it ( 'should generate warning if files listed in IntendedFor of fieldmap json do not exist' , function ( ) {
129167 var file = {
130168 name : 'sub-09_ses-test_run-01_fieldmap.nii.gz' ,
@@ -152,7 +190,7 @@ describe('NIFTI', function() {
152190 } )
153191 validate . NIFTI ( null , file , jsonContentsDict , { } , [ ] , [ ] , function ( issues ) {
154192 assert (
155- ( issues . length = 2 && issues [ 0 ] . code == 17 && issues [ 1 ] . code == 37 ) ,
193+ issues . length === 3 && issues [ 0 ] . code == 17 && issues [ 1 ] . code == 37 ,
156194 )
157195 } )
158196 } )
0 commit comments