aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unit/specs/services/file_type/file_type.spec.js19
1 files changed, 19 insertions, 0 deletions
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)
+ })
+ })
+})