summaryrefslogtreecommitdiff
path: root/spec/frontend/repository/utils/icon_spec.js
diff options
context:
space:
mode:
authorMartin Hanzel <mhanzel@gitlab.com>2019-06-05 10:18:12 +0200
committerMartin Hanzel <mhanzel@gitlab.com>2019-06-05 10:18:12 +0200
commit03c72e998dd8016ccda0a6b9515dd3fc0302978a (patch)
tree1f7e1623637de75c2807ef7d40f0feae08c687f3 /spec/frontend/repository/utils/icon_spec.js
parent3aeea7fb0c1d6389df6d8643ef40dd54aa84d1a8 (diff)
parentb560ce1e666733f12c65e8b9f659c89256c1775b (diff)
downloadgitlab-ce-03c72e998dd8016ccda0a6b9515dd3fc0302978a.tar.gz
Merge branch 'master' into mh/notes-specmh/notes-spec
Diffstat (limited to 'spec/frontend/repository/utils/icon_spec.js')
-rw-r--r--spec/frontend/repository/utils/icon_spec.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/frontend/repository/utils/icon_spec.js b/spec/frontend/repository/utils/icon_spec.js
new file mode 100644
index 00000000000..3d84705f7ea
--- /dev/null
+++ b/spec/frontend/repository/utils/icon_spec.js
@@ -0,0 +1,23 @@
+import { getIconName } from '~/repository/utils/icon';
+
+describe('getIconName', () => {
+ // Tests the returning font awesome icon name
+ // We only test one for each file type to save testing a lot of different
+ // file types
+ it.each`
+ type | path | icon
+ ${'tree'} | ${''} | ${'folder'}
+ ${'commit'} | ${''} | ${'archive'}
+ ${'file'} | ${'test.pdf'} | ${'file-pdf-o'}
+ ${'file'} | ${'test.jpg'} | ${'file-image-o'}
+ ${'file'} | ${'test.zip'} | ${'file-archive-o'}
+ ${'file'} | ${'test.mp3'} | ${'file-audio-o'}
+ ${'file'} | ${'test.flv'} | ${'file-video-o'}
+ ${'file'} | ${'test.dotx'} | ${'file-word-o'}
+ ${'file'} | ${'test.xlsb'} | ${'file-excel-o'}
+ ${'file'} | ${'test.ppam'} | ${'file-powerpoint-o'}
+ ${'file'} | ${'test.js'} | ${'file-text-o'}
+ `('returns $icon for $type with path $path', ({ type, path, icon }) => {
+ expect(getIconName(type, path)).toEqual(icon);
+ });
+});