From c68dac5f331fe1573d8c477e6b00292ad06b4f62 Mon Sep 17 00:00:00 2001 From: Mordy Tikotzky Date: Wed, 12 Jul 2017 20:25:44 -0400 Subject: [PATCH] Add tests for extensions with overridden contentTypes --- server/middleware/FileUtils.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 server/middleware/FileUtils.test.js diff --git a/server/middleware/FileUtils.test.js b/server/middleware/FileUtils.test.js new file mode 100644 index 0000000..7b97d5d --- /dev/null +++ b/server/middleware/FileUtils.test.js @@ -0,0 +1,25 @@ +const { getContentType, getStats, getFileType } = require('./FileUtils'); + +it('gets a contextType of text/plain for LICENSE|README|CHANGES|AUTHORS|Makefile', () => { + expect(getContentType('LICENSE')).toBe('text/plain'); + expect(getContentType('README')).toBe('text/plain'); + expect(getContentType('CHANGES')).toBe('text/plain'); + expect(getContentType('AUTHORS')).toBe('text/plain'); + expect(getContentType('Makefile')).toBe('text/plain'); +}); + +it('gets a contextType of text/plain for .*rc files', () => { + expect(getContentType('.eslintrc')).toBe('text/plain'); + expect(getContentType('.babelrc')).toBe('text/plain'); + expect(getContentType('.anythingrc')).toBe('text/plain'); +}); + +it('gets a contextType of text/plain for .git* files', () => { + expect(getContentType('.gitignore')).toBe('text/plain'); + expect(getContentType('.gitanything')).toBe('text/plain'); +}); + +it('gets a contextType of text/plain for .*ignore files', () => { + expect(getContentType('.eslintignore')).toBe('text/plain'); + expect(getContentType('.anythingignore')).toBe('text/plain'); +}); \ No newline at end of file