Skip to content

Commit

Permalink
Fix tests broken by last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
happy5214 committed Dec 27, 2023
1 parent ccb2ce2 commit c5d763d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 40 deletions.
29 changes: 16 additions & 13 deletions tests/bids.spec.data.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,6 @@ const sidecars = [
HED: '(Item-count/#, {response_time})',
},
},
{
// Invalid location of curly braces
event_code: {
HED: {
face: '(Red, Blue), (Green, (Yellow))',
ball: '(Def/Acc/{response_time})',
},
},
response_time: {
Description: 'Has description with HED',
HED: 'Label/#',
},
},
{
// Invalid use of mutually recursive curly brace references
event_code: {
Expand Down Expand Up @@ -510,6 +497,22 @@ const sidecars = [
},
},
],
// sub09 - Syntax errors
[
{
// Invalid location of curly braces
event_code: {
HED: {
face: '(Red, Blue), (Green, (Yellow))',
ball: '(Def/Acc/{response_time})',
},
},
response_time: {
Description: 'Has description with HED',
HED: 'Label/#',
},
},
],
]

const hedColumnOnlyHeader = 'onset\tduration\tHED\n'
Expand Down
53 changes: 26 additions & 27 deletions tests/bids.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,10 @@ describe('BIDS datasets', () => {
),
],
error_and_good: [
// TODO: Duplication temporary
BidsHedIssue.fromHedIssue(
converterGenerateIssue('invalidTag', 'Confused', {}, [0, 8]),
bidsSidecars[1][1].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('invalidTag', { tag: 'Confused', sidecarKey: 'emotion' }),
bidsSidecars[1][1].file,
),
],
}
return validator(testDatasets, expectedIssues, specs)
Expand Down Expand Up @@ -534,11 +529,13 @@ describe('BIDS datasets', () => {
const standaloneSidecars = bidsSidecars[6]
const combinedDatasets = bidsTsvFiles[8]
const hedColumnDatasets = bidsTsvFiles[9]
const syntaxSidecars = bidsSidecars[8].slice(0, 1)
const testDatasets = {
tsv: new BidsDataset(standaloneTsvFiles, []),
sidecars: new BidsDataset([], standaloneSidecars),
combined: new BidsDataset(combinedDatasets, []),
hedColumn: new BidsDataset(hedColumnDatasets, []),
syntax: new BidsDataset([], syntaxSidecars),
}
const expectedIssues = {
tsv: [
Expand All @@ -564,82 +561,74 @@ describe('BIDS datasets', () => {
}),
standaloneSidecars[1].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('invalidCharacter', {
character: '{',
index: 9,
string: '(Def/Acc/{response_time})',
}),
standaloneSidecars[6].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('recursiveCurlyBracesWithKey', {
column: 'response_time',
referrer: 'event_code',
}),
standaloneSidecars[7].file,
standaloneSidecars[6].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('recursiveCurlyBracesWithKey', {
column: 'event_code',
referrer: 'response_time',
}),
standaloneSidecars[7].file,
standaloneSidecars[6].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('recursiveCurlyBracesWithKey', {
column: 'event_type',
referrer: 'event_code',
}),
standaloneSidecars[8].file,
standaloneSidecars[7].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('recursiveCurlyBracesWithKey', {
column: 'response_time',
referrer: 'event_type',
}),
standaloneSidecars[8].file,
standaloneSidecars[7].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('recursiveCurlyBracesWithKey', {
column: 'response_time',
referrer: 'event_code',
}),
standaloneSidecars[8].file,
standaloneSidecars[7].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('recursiveCurlyBracesWithKey', {
column: 'response_time',
referrer: 'response_time',
}),
standaloneSidecars[9].file,
standaloneSidecars[8].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('unclosedCurlyBrace', {
index: 15,
string: standaloneSidecars[10].hedData.get('event_code').ball,
string: standaloneSidecars[9].hedData.get('event_code').ball,
}),
standaloneSidecars[10].file,
standaloneSidecars[9].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('nestedCurlyBrace', {
index: 1,
string: standaloneSidecars[10].hedData.get('event_code2').ball,
string: standaloneSidecars[9].hedData.get('event_code2').ball,
}),
standaloneSidecars[10].file,
standaloneSidecars[9].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('unopenedCurlyBrace', {
index: 15,
string: standaloneSidecars[10].hedData.get('event_code3').ball,
string: standaloneSidecars[9].hedData.get('event_code3').ball,
}),
standaloneSidecars[10].file,
standaloneSidecars[9].file,
),
BidsHedIssue.fromHedIssue(
generateIssue('emptyCurlyBrace', {
string: standaloneSidecars[10].hedData.get('event_code4').ball,
string: standaloneSidecars[9].hedData.get('event_code4').ball,
}),
standaloneSidecars[10].file,
standaloneSidecars[9].file,
),
],
combined: [
Expand Down Expand Up @@ -674,6 +663,16 @@ describe('BIDS datasets', () => {
hedColumnDatasets[0].file,
),
],
syntax: [
BidsHedIssue.fromHedIssue(
generateIssue('invalidCharacter', {
character: '{',
index: 9,
string: '(Def/Acc/{response_time})',
}),
syntaxSidecars[0].file,
),
],
}
return validator(testDatasets, expectedIssues, specs)
}, 10000)
Expand Down

0 comments on commit c5d763d

Please sign in to comment.