Skip to content

Commit

Permalink
Add video utils tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kowczarz committed Jan 25, 2024
1 parent 663b2db commit 62ef4c9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions __tests__/Str-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ describe('Str.isImage', () => {
});
});

describe('Str.isVideo', () => {
it('Correctly identifies all valid video types', () => {
expect(Str.isVideo(buildTestURLForType('mov'))).toBeTruthy();
expect(Str.isVideo(buildTestURLForType('mp4'))).toBeTruthy();
expect(Str.isVideo(buildTestURLForType('webm'))).toBeTruthy();
expect(Str.isVideo(buildTestURLForType('mkv'))).toBeTruthy();
expect(Str.isVideo(buildTestURLForType('MOV'))).toBeTruthy();
expect(Str.isVideo(buildTestURLForType('MP4'))).toBeTruthy();
expect(Str.isVideo(buildTestURLForType('WEBM'))).toBeTruthy();
expect(Str.isVideo(buildTestURLForType('MKV'))).toBeTruthy();
});

it('Does not confirm these types', () => {
// Note: These are types that React Native does not support as images so attempt to prevent their addition here
expect(Str.isVideo(buildTestURLForType('tiff'))).toBeFalsy();
expect(Str.isVideo(buildTestURLForType('psd'))).toBeFalsy();
expect(Str.isVideo(buildTestURLForType('pdf'))).toBeFalsy();
expect(Str.isVideo(buildTestURLForType('jpeg'))).toBeFalsy();
});
});

describe('Str.isPDF', () => {
it('Correctly identifies PDF', () => {
expect(Str.isPDF(buildTestURLForType('pdf'))).toBeTruthy();
Expand Down

0 comments on commit 62ef4c9

Please sign in to comment.