1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Files
docs/tests/unit/data-directory/filename-to-key.js
Kevin Heis 1b424dfdc4 Bring in data-directory, let's go async file reads (#16782)
* Bring in data-directory, let's go async file reads

* Lint fixes

* Update glossary.js
2020-12-09 11:20:24 -08:00

16 lines
468 B
JavaScript

const filenameToKey = require('../../../lib/filename-to-key')
describe('filename-to-key', () => {
test('converts filenames to object keys', () => {
expect(filenameToKey('foo/bar/baz.txt')).toBe('foo.bar.baz')
})
test('ignores leading slash on filenames', () => {
expect(filenameToKey('/foo/bar/baz.txt')).toBe('foo.bar.baz')
})
test('supports MS Windows paths', () => {
expect(filenameToKey('path\\to\\file.txt')).toBe('path.to.file')
})
})