summaryrefslogtreecommitdiff
path: root/spec/frontend/vue_shared/components/content_viewer/lib/viewer_utils_spec.js
blob: facdaa86f847f2210e9ed6f74b66403aab73f321 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils';

describe('viewerInformationForPath', () => {
  it.each`
    path                 | type
    ${'p/somefile.jpg'}  | ${'image'}
    ${'p/somefile.jpeg'} | ${'image'}
    ${'p/somefile.bmp'}  | ${'image'}
    ${'p/somefile.ico'}  | ${'image'}
    ${'p/somefile.png'}  | ${'image'}
    ${'p/somefile.gif'}  | ${'image'}
    ${'p/somefile.md'}   | ${'markdown'}
    ${'p/md'}            | ${undefined}
    ${'p/png'}           | ${undefined}
    ${'p/md.png/a'}      | ${undefined}
    ${'p/some-file.php'} | ${undefined}
  `('when path=$path, type=$type', ({ path, type }) => {
    expect(viewerInformationForPath(path)?.id).toBe(type);
  });
});