Skip to content

Commit

Permalink
Add test for an invalid HEDVersion field (covers last uncovered line …
Browse files Browse the repository at this point in the history
…in hed.js)
  • Loading branch information
happy5214 committed Jul 11, 2024
1 parent c105963 commit c057f90
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions bids-validator/tests/hed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,33 @@ describe('HED', function () {
assert.strictEqual(issues[0].code, 109)
})
})

it('should throw an issue if HEDVersion is invalid', () => {
const events = [
{
file: {
path: '/sub01/sub01_task-test_events.tsv',
relativePath: '/sub01/sub01_task-test_events.tsv',
},
path: '/sub01/sub01_task-test_events.tsv',
contents:
'onset\tduration\ttest\tHED\n' + '7\tsomething\tone\tSpeed/30 mph\n',
},
]
const jsonDictionary = {
'/sub01/sub01_task-test_events.json': {
myCodes: {
HED: {
one: 'Duration/5 s',
},
},
},
'/dataset_description.json': { HEDVersion: 'one:two:8.0.0' },
}

return validateHed(events, jsonDictionary, jsonFiles, '').then((issues) => {
assert.strictEqual(issues.length, 1)
assert.strictEqual(issues[0].code, 104)
})
})
})

0 comments on commit c057f90

Please sign in to comment.