From 15bcac81dd960fc2f6b9e33ec57f0a44b3102365 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Sun, 28 Jul 2024 21:53:40 -0400 Subject: [PATCH] test(tsv): Verify that n/a is permitted in both types of columns --- bids-validator/src/schema/applyRules.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bids-validator/src/schema/applyRules.test.ts b/bids-validator/src/schema/applyRules.test.ts index 15c812889..ef4c827bf 100644 --- a/bids-validator/src/schema/applyRules.test.ts +++ b/bids-validator/src/schema/applyRules.test.ts @@ -66,6 +66,7 @@ const schemaDefs = { MadeUp: { columns: { onset: 'required', + strain_rrid: 'optional', }, }, }, @@ -166,4 +167,20 @@ Deno.test('evalColumns tests', async (t) => { evalColumns(rule, context, schema, 'rules.tabular_data.made_up.MadeUp') assert(context.issues.hasIssue({ key: 'TSV_VALUE_INCORRECT_TYPE' })) }) + + await t.step('verify n/a is allowed', () => { + const context = { + path: '/sub-01/sub-01_something.tsv', + extension: '.tsv', + sidecar: {}, + columns: { + onset: ['1', '2', 'n/a'], + strain_rrid: ['RRID:SCR_012345', 'RRID:SCR_012345', 'n/a'], + }, + issues: new DatasetIssues(), + } + const rule = schemaDefs.rules.tabular_data.made_up.MadeUp + evalColumns(rule, context, schema, 'rules.tabular_data.made_up.MadeUp') + assert(context.issues.size === 0) + }) })