diff --git a/parser/columnSplicer.js b/parser/columnSplicer.js index fd365b04..5812bc7d 100644 --- a/parser/columnSplicer.js +++ b/parser/columnSplicer.js @@ -153,14 +153,15 @@ export class ColumnSplicer { _spliceHedColumnTemplate() { const columnName = 'HED' const replacementString = this.columnValues.get(columnName) - if (replacementString === null || replacementString === 'n/a' || replacementString === '') { + if ( + replacementString === undefined || + replacementString === null || + replacementString === 'n/a' || + replacementString === '' + ) { return null } - if (replacementString === undefined) { - this.issues.push(generateIssue('undefinedCurlyBraces', { column: columnName })) - return [] - } return this._reparseAndSpliceString(replacementString) } diff --git a/tests/bidsTests.spec.js b/tests/bidsTests.spec.js index a253ff83..7ab13c1c 100644 --- a/tests/bidsTests.spec.js +++ b/tests/bidsTests.spec.js @@ -16,7 +16,7 @@ const fs = require('fs') const displayLog = true // Ability to select individual tests to run -const runAll = false +const runAll = true let onlyRun = new Map() if (!runAll) { onlyRun = new Map([['duplicate-tag-tests', ['invalid-duplicate-groups-first-level-tsv']]]) diff --git a/tests/runLog.txt b/tests/runLog.txt index ec166b5a..a737db1d 100644 --- a/tests/runLog.txt +++ b/tests/runLog.txt @@ -1,23 +1,77 @@ -Total tests:3 Wrong errors:0 MissingErrors:0 -----Skipping valid-bids-datasets-with-limited-hed: no-hed-at-all-but-both-tsv-json-non-empty -----Skipping valid-bids-datasets-with-limited-hed: only-header-in-tsv-with-return -----Skipping valid-bids-datasets-with-limited-hed: empty-json-empty-tsv -----Skipping valid-json-invalid-tsv: valid-sidecar-bad-tag-tsv -----Skipping valid-json-invalid-tsv: valid-sidecar-tsv-curly-brace -----Skipping duplicate-tag-tests: invalid-first-level-duplicate-json-tsv +Total tests:57 Wrong errors:0 MissingErrors:0 +[no-hed-at-all-but-both-tsv-json-non-empty (Expect pass)] +[valid-bids-datasets-with-limited-hed:no-hed-at-all-but-both-tsv-json-non-empty][Sidecar only](Expect pass) +[valid-bids-datasets-with-limited-hed:no-hed-at-all-but-both-tsv-json-non-empty][Events only](Expect pass) +[valid-bids-datasets-with-limited-hed:no-hed-at-all-but-both-tsv-json-non-empty][Events+side](Expect pass) +[only-header-in-tsv-with-return (Expect pass)] +[valid-bids-datasets-with-limited-hed:only-header-in-tsv-with-return][Sidecar only](Expect pass) +[valid-bids-datasets-with-limited-hed:only-header-in-tsv-with-return][Events only](Expect pass) +[valid-bids-datasets-with-limited-hed:only-header-in-tsv-with-return][Events+side](Expect pass) +[empty-json-empty-tsv (Expect pass)] +[valid-bids-datasets-with-limited-hed:empty-json-empty-tsv][Sidecar only](Expect pass) +[valid-bids-datasets-with-limited-hed:empty-json-empty-tsv][Events only](Expect pass) +[valid-bids-datasets-with-limited-hed:empty-json-empty-tsv][Events+side](Expect pass) +[valid-sidecar-bad-tag-tsv (Expect pass)] +[valid-json-invalid-tsv:valid-sidecar-bad-tag-tsv][Sidecar only](Expect pass) +[valid-json-invalid-tsv:valid-sidecar-bad-tag-tsv][Events only](Expect fail) +[valid-json-invalid-tsv:valid-sidecar-bad-tag-tsv][Events+side](Expect fail) +[valid-sidecar-tsv-curly-brace (Expect pass)] +[valid-json-invalid-tsv:valid-sidecar-tsv-curly-brace][Sidecar only](Expect pass) +[valid-json-invalid-tsv:valid-sidecar-tsv-curly-brace][Events only](Expect fail) +[valid-json-invalid-tsv:valid-sidecar-tsv-curly-brace][Events+side](Expect fail) +[invalid-first-level-duplicate-json-tsv (Expect pass)] +[duplicate-tag-tests:invalid-first-level-duplicate-json-tsv][Sidecar only](Expect pass) +[duplicate-tag-tests:invalid-first-level-duplicate-json-tsv][Events only](Expect pass) +[duplicate-tag-tests:invalid-first-level-duplicate-json-tsv][Events+side](Expect fail) [invalid-duplicate-groups-first-level-tsv (Expect pass)] [duplicate-tag-tests:invalid-duplicate-groups-first-level-tsv][Sidecar only](Expect pass) [duplicate-tag-tests:invalid-duplicate-groups-first-level-tsv][Events only](Expect fail) [duplicate-tag-tests:invalid-duplicate-groups-first-level-tsv][Events+side](Expect fail) -----Skipping curly-brace-tests: valid-curly-brace-in-sidecar-with-value-splice -----Skipping curly-brace-tests: valid-curly-brace-in-sidecar-with-category-splice -----Skipping curly-brace-tests: valid-curly-brace-in-sidecar-with-n/a-splice -----Skipping curly-brace-tests: valid-HED-column-splice -----Skipping curly-brace-tests: valid-HED-column-splice-with-n/a -----Skipping curly-brace-tests: invalid-curly-brace-column-slice-has-no hed -----Skipping curly-brace-tests: invalid-HED-curly-brace-but-tsv-has-no-HED-column -----Skipping curly-brace-tests: invalid-curly-brace-in-HED-tsv-column -----Skipping curly-brace-tests: invalid-curly-brace-in-HED-tsv-column -----Skipping curly-brace-tests: invalid-recursive-curly-braces -----Skipping curly-brace-tests: invalid-self-recursive-curly-braces -----Skipping curly-brace-tests: invalid-recursive-curly-brace-chain \ No newline at end of file +[valid-curly-brace-in-sidecar-with-value-splice (Expect pass)] +[curly-brace-tests:valid-curly-brace-in-sidecar-with-value-splice][Sidecar only](Expect pass) +[curly-brace-tests:valid-curly-brace-in-sidecar-with-value-splice][Events only](Expect pass) +[curly-brace-tests:valid-curly-brace-in-sidecar-with-value-splice][Events+side](Expect pass) +[valid-curly-brace-in-sidecar-with-category-splice (Expect pass)] +[curly-brace-tests:valid-curly-brace-in-sidecar-with-category-splice][Sidecar only](Expect pass) +[curly-brace-tests:valid-curly-brace-in-sidecar-with-category-splice][Events only](Expect pass) +[curly-brace-tests:valid-curly-brace-in-sidecar-with-category-splice][Events+side](Expect pass) +[valid-curly-brace-in-sidecar-with-n/a-splice (Expect pass)] +[curly-brace-tests:valid-curly-brace-in-sidecar-with-n/a-splice][Sidecar only](Expect pass) +[curly-brace-tests:valid-curly-brace-in-sidecar-with-n/a-splice][Events only](Expect pass) +[curly-brace-tests:valid-curly-brace-in-sidecar-with-n/a-splice][Events+side](Expect pass) +[valid-HED-column-splice (Expect pass)] +[curly-brace-tests:valid-HED-column-splice][Sidecar only](Expect pass) +[curly-brace-tests:valid-HED-column-splice][Events only](Expect pass) +[curly-brace-tests:valid-HED-column-splice][Events+side](Expect pass) +[valid-HED-column-splice-with-n/a (Expect pass)] +[curly-brace-tests:valid-HED-column-splice-with-n/a][Sidecar only](Expect pass) +[curly-brace-tests:valid-HED-column-splice-with-n/a][Events only](Expect pass) +[curly-brace-tests:valid-HED-column-splice-with-n/a][Events+side](Expect pass) +[invalid-curly-brace-column-slice-has-no hed (Expect pass)] +[curly-brace-tests:invalid-curly-brace-column-slice-has-no hed][Sidecar only](Expect fail) +[curly-brace-tests:invalid-curly-brace-column-slice-has-no hed][Events only](Expect pass) +[curly-brace-tests:invalid-curly-brace-column-slice-has-no hed][Events+side](Expect fail) +[valid-HED-curly-brace-but-tsv-has-no-HED-column (Expect pass)] +[curly-brace-tests:valid-HED-curly-brace-but-tsv-has-no-HED-column][Sidecar only](Expect pass) +[curly-brace-tests:valid-HED-curly-brace-but-tsv-has-no-HED-column][Events only](Expect pass) +[curly-brace-tests:valid-HED-curly-brace-but-tsv-has-no-HED-column][Events+side](Expect pass) +[invalid-curly-brace-in-HED-tsv-column (Expect pass)] +[curly-brace-tests:invalid-curly-brace-in-HED-tsv-column][Sidecar only](Expect pass) +[curly-brace-tests:invalid-curly-brace-in-HED-tsv-column][Events only](Expect fail) +[curly-brace-tests:invalid-curly-brace-in-HED-tsv-column][Events+side](Expect fail) +[invalid-curly-brace-in-HED-tsv-column (Expect pass)] +[curly-brace-tests:invalid-curly-brace-in-HED-tsv-column][Sidecar only](Expect pass) +[curly-brace-tests:invalid-curly-brace-in-HED-tsv-column][Events only](Expect fail) +[curly-brace-tests:invalid-curly-brace-in-HED-tsv-column][Events+side](Expect fail) +[invalid-recursive-curly-braces (Expect pass)] +[curly-brace-tests:invalid-recursive-curly-braces][Sidecar only](Expect fail) +[curly-brace-tests:invalid-recursive-curly-braces][Events only](Expect pass) +[curly-brace-tests:invalid-recursive-curly-braces][Events+side](Expect fail) +[invalid-self-recursive-curly-braces (Expect pass)] +[curly-brace-tests:invalid-self-recursive-curly-braces][Sidecar only](Expect fail) +[curly-brace-tests:invalid-self-recursive-curly-braces][Events only](Expect pass) +[curly-brace-tests:invalid-self-recursive-curly-braces][Events+side](Expect fail) +[invalid-recursive-curly-brace-chain (Expect pass)] +[curly-brace-tests:invalid-recursive-curly-brace-chain][Sidecar only](Expect fail) +[curly-brace-tests:invalid-recursive-curly-brace-chain][Events only](Expect pass) +[curly-brace-tests:invalid-recursive-curly-brace-chain][Events+side](Expect fail) \ No newline at end of file diff --git a/tests/testData/bidsTests.data.js b/tests/testData/bidsTests.data.js index 9de91972..419eda0b 100644 --- a/tests/testData/bidsTests.data.js +++ b/tests/testData/bidsTests.data.js @@ -325,7 +325,7 @@ export const bidsTestData = [ }, { testname: 'invalid-curly-brace-column-slice-has-no hed', - explanation: 'A column name is used in a splice but does not have HED', + explanation: 'A column name is used in a splice but does not have a HED key', schemaVersion: '8.3.0', sidecar: { event_code: { @@ -351,7 +351,7 @@ export const bidsTestData = [ ], }, { - testname: 'invalid-HED-curly-brace-but-tsv-has-no-HED-column', + testname: 'valid-HED-curly-brace-but-tsv-has-no-HED-column', explanation: 'A {HED} column splice is used in a sidecar but the tsv has no HED column', schemaVersion: '8.3.0', sidecar: { @@ -365,16 +365,7 @@ export const bidsTestData = [ eventsString: 'onset\tduration\tevent_code\n' + '19\t6\tball\n', sidecarOnlyErrors: [], eventsOnlyErrors: [], - comboErrors: [ - BidsHedIssue.fromHedIssue( - generateIssue('undefinedCurlyBraces', { column: 'HED' }), - { - path: 'invalid-HED-curly-brace-but-tsv-has-no-HED-column.tsv', - relativePath: 'invalid-HED-curly-brace-but-tsv-has-no-HED-column.tsv', - }, - { tsvLine: 2 }, - ), - ], + comboErrors: [], }, { testname: 'invalid-curly-brace-in-HED-tsv-column',