@@ -21,108 +21,108 @@ import { isAudioUrl, isImageUrl, isVideoUrl } from "./media-type.util";
2121
2222describe ( "isImageUrl" , ( ) => {
2323 it ( "should return true for data:image/ data URLs" , ( ) => {
24- expect ( isImageUrl ( "data:image/png;base64,abc123" ) ) . toBeTrue ( ) ;
25- expect ( isImageUrl ( "data:image/jpeg;base64,abc123" ) ) . toBeTrue ( ) ;
26- expect ( isImageUrl ( "data:image/webp;base64,abc123" ) ) . toBeTrue ( ) ;
24+ expect ( isImageUrl ( "data:image/png;base64,abc123" ) ) . toBe ( true ) ;
25+ expect ( isImageUrl ( "data:image/jpeg;base64,abc123" ) ) . toBe ( true ) ;
26+ expect ( isImageUrl ( "data:image/webp;base64,abc123" ) ) . toBe ( true ) ;
2727 } ) ;
2828
2929 it ( "should return true for common image file extensions" , ( ) => {
30- expect ( isImageUrl ( "https://example.com/photo.png" ) ) . toBeTrue ( ) ;
31- expect ( isImageUrl ( "https://example.com/photo.jpg" ) ) . toBeTrue ( ) ;
32- expect ( isImageUrl ( "https://example.com/photo.jpeg" ) ) . toBeTrue ( ) ;
33- expect ( isImageUrl ( "https://example.com/photo.gif" ) ) . toBeTrue ( ) ;
34- expect ( isImageUrl ( "https://example.com/photo.webp" ) ) . toBeTrue ( ) ;
30+ expect ( isImageUrl ( "https://example.com/photo.png" ) ) . toBe ( true ) ;
31+ expect ( isImageUrl ( "https://example.com/photo.jpg" ) ) . toBe ( true ) ;
32+ expect ( isImageUrl ( "https://example.com/photo.jpeg" ) ) . toBe ( true ) ;
33+ expect ( isImageUrl ( "https://example.com/photo.gif" ) ) . toBe ( true ) ;
34+ expect ( isImageUrl ( "https://example.com/photo.webp" ) ) . toBe ( true ) ;
3535 } ) ;
3636
3737 it ( "should be case-insensitive for extensions" , ( ) => {
38- expect ( isImageUrl ( "https://example.com/photo.PNG" ) ) . toBeTrue ( ) ;
39- expect ( isImageUrl ( "https://example.com/photo.JPG" ) ) . toBeTrue ( ) ;
38+ expect ( isImageUrl ( "https://example.com/photo.PNG" ) ) . toBe ( true ) ;
39+ expect ( isImageUrl ( "https://example.com/photo.JPG" ) ) . toBe ( true ) ;
4040 } ) ;
4141
4242 it ( "should return true for URLs with query strings" , ( ) => {
43- expect ( isImageUrl ( "https://example.com/photo.png?v=1" ) ) . toBeTrue ( ) ;
43+ expect ( isImageUrl ( "https://example.com/photo.png?v=1" ) ) . toBe ( true ) ;
4444 } ) ;
4545
4646 it ( "should return false for audio and video URLs" , ( ) => {
47- expect ( isImageUrl ( "data:audio/mp3;base64,abc" ) ) . toBeFalse ( ) ;
48- expect ( isImageUrl ( "data:video/mp4;base64,abc" ) ) . toBeFalse ( ) ;
49- expect ( isImageUrl ( "https://example.com/clip.mp4" ) ) . toBeFalse ( ) ;
47+ expect ( isImageUrl ( "data:audio/mp3;base64,abc" ) ) . toBe ( false ) ;
48+ expect ( isImageUrl ( "data:video/mp4;base64,abc" ) ) . toBe ( false ) ;
49+ expect ( isImageUrl ( "https://example.com/clip.mp4" ) ) . toBe ( false ) ;
5050 } ) ;
5151
5252 it ( "should return false for plain text strings" , ( ) => {
53- expect ( isImageUrl ( "hello world" ) ) . toBeFalse ( ) ;
54- expect ( isImageUrl ( "" ) ) . toBeFalse ( ) ;
53+ expect ( isImageUrl ( "hello world" ) ) . toBe ( false ) ;
54+ expect ( isImageUrl ( "" ) ) . toBe ( false ) ;
5555 } ) ;
5656} ) ;
5757
5858describe ( "isAudioUrl" , ( ) => {
5959 it ( "should return true for data:audio/ data URLs" , ( ) => {
60- expect ( isAudioUrl ( "data:audio/mp3;base64,abc123" ) ) . toBeTrue ( ) ;
61- expect ( isAudioUrl ( "data:audio/wav;base64,abc123" ) ) . toBeTrue ( ) ;
60+ expect ( isAudioUrl ( "data:audio/mp3;base64,abc123" ) ) . toBe ( true ) ;
61+ expect ( isAudioUrl ( "data:audio/wav;base64,abc123" ) ) . toBe ( true ) ;
6262 } ) ;
6363
6464 it ( "should return true for common audio file extensions" , ( ) => {
65- expect ( isAudioUrl ( "https://example.com/clip.mp3" ) ) . toBeTrue ( ) ;
66- expect ( isAudioUrl ( "https://example.com/clip.wav" ) ) . toBeTrue ( ) ;
67- expect ( isAudioUrl ( "https://example.com/clip.ogg" ) ) . toBeTrue ( ) ;
68- expect ( isAudioUrl ( "https://example.com/clip.m4a" ) ) . toBeTrue ( ) ;
69- expect ( isAudioUrl ( "https://example.com/clip.flac" ) ) . toBeTrue ( ) ;
65+ expect ( isAudioUrl ( "https://example.com/clip.mp3" ) ) . toBe ( true ) ;
66+ expect ( isAudioUrl ( "https://example.com/clip.wav" ) ) . toBe ( true ) ;
67+ expect ( isAudioUrl ( "https://example.com/clip.ogg" ) ) . toBe ( true ) ;
68+ expect ( isAudioUrl ( "https://example.com/clip.m4a" ) ) . toBe ( true ) ;
69+ expect ( isAudioUrl ( "https://example.com/clip.flac" ) ) . toBe ( true ) ;
7070 } ) ;
7171
7272 it ( "should be case-insensitive for extensions" , ( ) => {
73- expect ( isAudioUrl ( "https://example.com/clip.MP3" ) ) . toBeTrue ( ) ;
74- expect ( isAudioUrl ( "https://example.com/clip.WAV" ) ) . toBeTrue ( ) ;
73+ expect ( isAudioUrl ( "https://example.com/clip.MP3" ) ) . toBe ( true ) ;
74+ expect ( isAudioUrl ( "https://example.com/clip.WAV" ) ) . toBe ( true ) ;
7575 } ) ;
7676
7777 it ( "should return true for URLs with query strings" , ( ) => {
78- expect ( isAudioUrl ( "https://example.com/clip.mp3?token=xyz" ) ) . toBeTrue ( ) ;
78+ expect ( isAudioUrl ( "https://example.com/clip.mp3?token=xyz" ) ) . toBe ( true ) ;
7979 } ) ;
8080
8181 it ( "should return false for image and video URLs" , ( ) => {
82- expect ( isAudioUrl ( "data:image/png;base64,abc" ) ) . toBeFalse ( ) ;
83- expect ( isAudioUrl ( "data:video/mp4;base64,abc" ) ) . toBeFalse ( ) ;
84- expect ( isAudioUrl ( "https://example.com/photo.png" ) ) . toBeFalse ( ) ;
82+ expect ( isAudioUrl ( "data:image/png;base64,abc" ) ) . toBe ( false ) ;
83+ expect ( isAudioUrl ( "data:video/mp4;base64,abc" ) ) . toBe ( false ) ;
84+ expect ( isAudioUrl ( "https://example.com/photo.png" ) ) . toBe ( false ) ;
8585 } ) ;
8686
8787 it ( "should return false for plain text strings" , ( ) => {
88- expect ( isAudioUrl ( "hello world" ) ) . toBeFalse ( ) ;
89- expect ( isAudioUrl ( "" ) ) . toBeFalse ( ) ;
88+ expect ( isAudioUrl ( "hello world" ) ) . toBe ( false ) ;
89+ expect ( isAudioUrl ( "" ) ) . toBe ( false ) ;
9090 } ) ;
9191} ) ;
9292
9393describe ( "isVideoUrl" , ( ) => {
9494 it ( "should return true for data:video/ data URLs" , ( ) => {
95- expect ( isVideoUrl ( "data:video/mp4;base64,abc123" ) ) . toBeTrue ( ) ;
96- expect ( isVideoUrl ( "data:video/webm;base64,abc123" ) ) . toBeTrue ( ) ;
95+ expect ( isVideoUrl ( "data:video/mp4;base64,abc123" ) ) . toBe ( true ) ;
96+ expect ( isVideoUrl ( "data:video/webm;base64,abc123" ) ) . toBe ( true ) ;
9797 } ) ;
9898
9999 it ( "should return true for common video file extensions" , ( ) => {
100- expect ( isVideoUrl ( "https://example.com/clip.mp4" ) ) . toBeTrue ( ) ;
101- expect ( isVideoUrl ( "https://example.com/clip.webm" ) ) . toBeTrue ( ) ;
102- expect ( isVideoUrl ( "https://example.com/clip.ogg" ) ) . toBeTrue ( ) ;
100+ expect ( isVideoUrl ( "https://example.com/clip.mp4" ) ) . toBe ( true ) ;
101+ expect ( isVideoUrl ( "https://example.com/clip.webm" ) ) . toBe ( true ) ;
102+ expect ( isVideoUrl ( "https://example.com/clip.ogg" ) ) . toBe ( true ) ;
103103 } ) ;
104104
105105 it ( "should return true for fal.media CDN URLs" , ( ) => {
106- expect ( isVideoUrl ( "https://v3b.fal.media/files/abc123/output.mp4" ) ) . toBeTrue ( ) ;
106+ expect ( isVideoUrl ( "https://v3b.fal.media/files/abc123/output.mp4" ) ) . toBe ( true ) ;
107107 } ) ;
108108
109109 it ( "should be case-insensitive for extensions" , ( ) => {
110- expect ( isVideoUrl ( "https://example.com/clip.MP4" ) ) . toBeTrue ( ) ;
111- expect ( isVideoUrl ( "https://example.com/clip.WEBM" ) ) . toBeTrue ( ) ;
110+ expect ( isVideoUrl ( "https://example.com/clip.MP4" ) ) . toBe ( true ) ;
111+ expect ( isVideoUrl ( "https://example.com/clip.WEBM" ) ) . toBe ( true ) ;
112112 } ) ;
113113
114114 it ( "should return true for URLs with query strings" , ( ) => {
115- expect ( isVideoUrl ( "https://example.com/clip.mp4?t=5" ) ) . toBeTrue ( ) ;
115+ expect ( isVideoUrl ( "https://example.com/clip.mp4?t=5" ) ) . toBe ( true ) ;
116116 } ) ;
117117
118118 it ( "should return false for image and audio URLs" , ( ) => {
119- expect ( isVideoUrl ( "data:image/png;base64,abc" ) ) . toBeFalse ( ) ;
120- expect ( isVideoUrl ( "data:audio/mp3;base64,abc" ) ) . toBeFalse ( ) ;
121- expect ( isVideoUrl ( "https://example.com/photo.jpg" ) ) . toBeFalse ( ) ;
119+ expect ( isVideoUrl ( "data:image/png;base64,abc" ) ) . toBe ( false ) ;
120+ expect ( isVideoUrl ( "data:audio/mp3;base64,abc" ) ) . toBe ( false ) ;
121+ expect ( isVideoUrl ( "https://example.com/photo.jpg" ) ) . toBe ( false ) ;
122122 } ) ;
123123
124124 it ( "should return false for plain text strings" , ( ) => {
125- expect ( isVideoUrl ( "hello world" ) ) . toBeFalse ( ) ;
126- expect ( isVideoUrl ( "" ) ) . toBeFalse ( ) ;
125+ expect ( isVideoUrl ( "hello world" ) ) . toBe ( false ) ;
126+ expect ( isVideoUrl ( "" ) ) . toBe ( false ) ;
127127 } ) ;
128128} ) ;
0 commit comments