From 3978aaef84cc023908155343af76983f2715cf90 Mon Sep 17 00:00:00 2001 From: shpuld Date: Sat, 26 Jan 2019 17:45:03 +0200 Subject: Redo everything in the MR --- test/unit/specs/services/file_type/file_type.spec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/unit/specs/services/file_type/file_type.spec.js (limited to 'test/unit') diff --git a/test/unit/specs/services/file_type/file_type.spec.js b/test/unit/specs/services/file_type/file_type.spec.js new file mode 100644 index 00000000..eb8a087d --- /dev/null +++ b/test/unit/specs/services/file_type/file_type.spec.js @@ -0,0 +1,19 @@ +import fileType from 'src/services/file_type/file_type.service.js' + +describe('fileType service', () => { + describe('fileMatchesSomeType', () => { + it('should be true when file type is one of the listed', () => { + const file = { mimetype: 'audio/mpeg' } + const types = ['video', 'audio'] + + expect(fileType.fileMatchesSomeType(types, file)).to.eql(true) + }) + + it('should be false when files type is not included in type list', () => { + const file = { mimetype: 'audio/mpeg' } + const types = ['image', 'video'] + + expect(fileType.fileMatchesSomeType(types, file)).to.eql(false) + }) + }) +}) -- cgit v1.2.3-70-g09d2