<commit_before>const assert = require('chai').assert
const { getFolderSubjects } = require('../checkAnyDataPresent.js')

describe('checkAnyDataPresent', () => {
  describe('getFolderSubjects()', () => {
    it('returns only unique subjects', () => {
      // Native FileList but an array simulates it
      const fileList = [
        { relativePath: 'sub-01/files' },
        { relativePath: 'sub-01/another' },
        { relativePath: 'sub-02/data' },
      ]
      assert.equal(2, getFolderSubjects(fileList).length)
    })
    it('filters out emptyroom subject', () => {
      const fileList = [
        { relativePath: 'sub-01/files' },
        { relativePath: 'sub-emptyroom/data' },
      ]
      assert.equal(1, getFolderSubjects(fileList).length)
    })
  })
})<commit_msg>Add failing test for deeper nested directories in getFolderSubjects<commit_after>const assert = require('chai').assert
const { getFolderSubjects } = require('../checkAnyDataPresent.js')

describe('checkAnyDataPresent', () => {
  describe('getFolderSubjects()', () => {
    it('returns only unique subjects', () => {
      // Native FileList but an array simulates it
      const fileList = [
        { relativePath: 'sub-01/files' },
        { relativePath: 'sub-01/another' },
        { relativePath: 'sub-02/data' },
      ]
      assert.lengthOf(getFolderSubjects(fileList), 2)
    })
    it('filters out emptyroom subject', () => {
      const fileList = [
        { relativePath: 'sub-01/files' },
        { relativePath: 'sub-emptyroom/data' },
      ]
      assert.lengthOf(getFolderSubjects(fileList), 1)
    })
    it('works for deeply nested files', () => {
      const fileList = [
        { relativePath: 'sub-01/files/a.nii.gz' },
        { relativePath: 'sub-01/another/b.nii.gz' },
        { relativePath: 'sub-02/data/test' },
      ]
      assert.lengthOf(getFolderSubjects(fileList), 2)
    })
  })
})
{'fraction_non_alphanumeric': 0.16052631578947368, 'fraction_numerical': 0.014210526315789474, 'mean_word_length': 2.7944111776447107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '668859', 'n_tokens_mistral': 603, 'n_tokens_neox': 582, 'n_words': 105}