-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(utils): Add comprehensive unit tests for
format-utils
module (#86
) - Added tests for `DateFormatter` methods: - `constructor` with valid and invalid inputs - `fromMicroseconds` with valid and invalid inputs - `toMicroseconds` and `micros` methods - `toMilliseconds` and `millis` methods - `toISOString` and `toISO` methods - `toDateObject` method - `toString` method - `toLocaleString` method with various locales - Added tests for `FormatUtils` methods: - `parseFormatObject` with valid and invalid inputs - `sortThumbnailsByResolution` with valid and invalid inputs - `getAuthorThumbnails` with various scenarios - `getVideoThumbnails` with various scenarios - `getAllThumbnails` with various scenarios - `getThumbnailByResolution` with various scenarios - `getThumbnail` with various scenarios - `hasVideo` with formats containing and not containing video - `hasAudio` with formats containing and not containing audio - Added several assets for these unit tests to test various scenarios: - `test/assets/json/formats.json` - `test/assets/json/videoThumbnails.json` - `test/assets/json/authorThumbnails.json` Authored-by: Ryuu Mitsuki <dhefam31@gmail.com>
- Loading branch information
Showing
4 changed files
with
597 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[ | ||
{ | ||
"url": "https://yt3.ggpht.com/EXAMPLE=s48-c-k-c0x00ffffff-no-rj", | ||
"width": 48, | ||
"height": 48 | ||
}, | ||
{ | ||
"url": "https://yt3.ggpht.com/EXAMPLE=s88-c-k-c0x00ffffff-no-rj", | ||
"width": 88, | ||
"height": 88 | ||
}, | ||
{ | ||
"url": "https://yt3.ggpht.com/EXAMPLE=s176-c-k-c0x00ffffff-no-rj", | ||
"width": 176, | ||
"height": 176 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"audioonly": { | ||
"mimeType": "audio/mp4; codecs=\"mp4a.40.2\"", | ||
"qualityLabel": null, | ||
"bitrate": 131110, | ||
"audioBitrate": 128, | ||
"itag": 140, | ||
"url": "https://example.com/videoplayback?audio-only", | ||
"initRange": { | ||
"start": "0", | ||
"end": "667" | ||
}, | ||
"indexRange": { | ||
"start": "668", | ||
"end": "1023" | ||
}, | ||
"lastModified": "1649941229498837", | ||
"contentLength": "4317886", | ||
"quality": "tiny", | ||
"projectionType": "RECTANGULAR", | ||
"averageBitrate": 129556, | ||
"highReplication": true, | ||
"audioQuality": "AUDIO_QUALITY_MEDIUM", | ||
"approxDurationMs": "266626", | ||
"audioSampleRate": "44100", | ||
"audioChannels": 2, | ||
"loudnessDb": 7.81, | ||
"hasVideo": false, | ||
"hasAudio": true, | ||
"container": "mp4", | ||
"codecs": "mp4a.40.2", | ||
"videoCodec": null, | ||
"audioCodec": "mp4a.40.2", | ||
"isLive": false, | ||
"isHLS": false, | ||
"isDashMPD": false | ||
}, | ||
"videoonly": { | ||
"mimeType": "video/webm; codecs=\"vp9\"", | ||
"qualityLabel": "1080p", | ||
"bitrate": 2764193, | ||
"itag": 137, | ||
"url": "https://example.com/videoplayback?video-only", | ||
"initRange": { | ||
"start": "0", | ||
"end": "239" | ||
}, | ||
"indexRange": { | ||
"start": "240", | ||
"end": "500" | ||
}, | ||
"lastModified": "1649941229498837", | ||
"contentLength": "108642789", | ||
"quality": "hd1080", | ||
"projectionType": "RECTANGULAR", | ||
"averageBitrate": 2764173, | ||
"highReplication": false, | ||
"approxDurationMs": "266626", | ||
"hasVideo": true, | ||
"hasAudio": false, | ||
"container": "webm", | ||
"codecs": "vp9", | ||
"videoCodec": "vp9", | ||
"audioCodec": null, | ||
"isLive": false, | ||
"isHLS": false, | ||
"isDashMPD": false | ||
}, | ||
"combined": { | ||
"mimeType": "video/mp4; codecs=\"avc1.640028, mp4a.40.2\"", | ||
"qualityLabel": "720p", | ||
"bitrate": 1581508, | ||
"itag": 22, | ||
"url": "https://example.com/videoplayback?combined", | ||
"lastModified": "1649941229498837", | ||
"contentLength": "5400000", | ||
"quality": "hd720", | ||
"projectionType": "RECTANGULAR", | ||
"averageBitrate": 1575000, | ||
"audioQuality": "AUDIO_QUALITY_MEDIUM", | ||
"approxDurationMs": "266626", | ||
"audioSampleRate": "44100", | ||
"audioChannels": 2, | ||
"loudnessDb": 5.43, | ||
"hasVideo": true, | ||
"hasAudio": true, | ||
"container": "mp4", | ||
"codecs": "avc1.640028, mp4a.40.2", | ||
"videoCodec": "avc1.640028", | ||
"audioCodec": "mp4a.40.2", | ||
"isLive": false, | ||
"isHLS": false, | ||
"isDashMPD": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"url": "https://i.ytimg.com/vi/VIDEO_ID/hqdefault.jpg", | ||
"width": 168, | ||
"height": 94 | ||
}, | ||
{ | ||
"url": "https://i.ytimg.com/vi/VIDEO_ID/mqdefault.jpg", | ||
"width": 320, | ||
"height": 180 | ||
}, | ||
{ | ||
"url": "https://i.ytimg.com/vi/VIDEO_ID/sddefault.jpg", | ||
"width": 640, | ||
"height": 480 | ||
}, | ||
{ | ||
"url": "https://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg", | ||
"width": 1280, | ||
"height": 720 | ||
} | ||
] |
Oops, something went wrong.