import { isValidExtension } from '../utils';

it.each`
  fileAccept     | filename             | fileType              | expected
  ${'.png'}      | ${'attachment.png'}  | ${'image/png'}        | ${true}
  ${'.PNG'}      | ${'attachment.png'}  | ${'image/png'}        | ${true}
  ${'.png'}      | ${'attachment'}      | ${'image/png'}        | ${false}
  ${'image/png'} | ${'attachment.png'}  | ${'image/png'}        | ${true}
  ${'image/PNG'} | ${'attachment.png'}  | ${'image/png'}        | ${true}
  ${'image/png'} | ${'attachment.png'}  | ${'image/jpeg'}       | ${false}
  ${'image/*'}   | ${'attachment.png'}  | ${'image/png'}        | ${true}
  ${'IMAGE/*'}   | ${'attachment.png'}  | ${'image/png'}        | ${true}
  ${'image/*'}   | ${'attachment.gzip'} | ${'application/gzip'} | ${false}
`('returns correctly', ({ fileAccept, filename, fileType, expected }) => {
  const actual = isValidExtension(filename, fileType)(fileAccept);
  expect(actual).toEqual(expected);
});
