Merge pull request #8701 from overleaf/bg-simple-iterable-paths

simple iterable paths

GitOrigin-RevId: f6906016888ccfc95c88858bdac4d2633fc1c5f4
This commit is contained in:
Brian Gough
2022-07-05 08:03:43 +00:00
committed by Copybot
parent be71ea690d
commit 5a3318f5b3
7 changed files with 53 additions and 15 deletions
@@ -0,0 +1,18 @@
const { expect } = require('chai')
const {
iterablePaths,
} = require('../../../../app/src/Features/Project/IterablePath')
describe('iterablePaths', function () {
it('returns an empty array for empty folders', function () {
expect(iterablePaths(null, 'docs')).to.deep.equal([])
expect(iterablePaths({}, 'docs')).to.deep.equal([])
})
it('returns the `docs` object when it is iterable', function () {
const folder = {
docs: [{ _id: 1 }, { _id: 2 }],
}
expect(iterablePaths(folder, 'docs')).to.equal(folder.docs)
})
})