@@ -5,81 +5,77 @@ import { assertSnapshot } from "@std/testing/snapshot";
55 * This test suite verifies the parseYoutube function's ability to handle various
66 * YouTube URL formats and invalid inputs using snapshot testing.
77 */
8- Deno . test ( {
9- name : "youtube links" ,
10- ignore : true ,
11- fn : async ( t ) => {
12- /** Test valid YouTube URL formats
13- * Verifies parsing of:
14- * - Standard watch URLs (youtube.com/watch?v=...)
15- * - Playlist URLs (youtube.com/playlist?list=...)
16- * - Watch URLs within playlists
17- * - YouTube Music URLs (music.youtube.com)
18- * - Short URLs (youtu.be/...)
19- */
20- await t . step ( "is" , async ( t ) => {
21- await assertSnapshot (
22- t ,
23- parseYoutube ( "https://www.youtube.com/watch?v=LSvaOcaUQ3Y" ) ,
24- ) ;
25- await assertSnapshot (
26- t ,
27- parseYoutube (
28- "https://www.youtube.com/playlist?list=PLmoRDY8IgE2Okxy4WWdP95RHXOTGzJfQs" ,
29- ) ,
30- ) ;
31- await assertSnapshot (
32- t ,
33- parseYoutube (
34- "https://www.youtube.com/watch?v=57rdbK4vmKE&list=PLmoRDY8IgE2Okxy4WWdP95RHXOTGzJfQs" ,
35- ) ,
36- ) ;
37- await assertSnapshot (
38- t ,
39- parseYoutube (
40- "https://music.youtube.com/watch?v=nj1cre2e6t0" ,
41- ) ,
42- ) ;
43- await assertSnapshot (
44- t ,
45- parseYoutube (
46- "https://youtu.be/nj1cre2e6t0" ,
47- ) ,
48- ) ;
49- } ) ;
8+ Deno . test ( "youtube links" , async ( t ) => {
9+ /** Test valid YouTube URL formats
10+ * Verifies parsing of:
11+ * - Standard watch URLs (youtube.com/watch?v=...)
12+ * - Playlist URLs (youtube.com/playlist?list=...)
13+ * - Watch URLs within playlists
14+ * - YouTube Music URLs (music.youtube.com)
15+ * - Short URLs (youtu.be/...)
16+ */
17+ await t . step ( "is" , async ( t ) => {
18+ await assertSnapshot (
19+ t ,
20+ parseYoutube ( "https://www.youtube.com/watch?v=LSvaOcaUQ3Y" ) ,
21+ ) ;
22+ await assertSnapshot (
23+ t ,
24+ parseYoutube (
25+ "https://www.youtube.com/playlist?list=PLmoRDY8IgE2Okxy4WWdP95RHXOTGzJfQs" ,
26+ ) ,
27+ ) ;
28+ await assertSnapshot (
29+ t ,
30+ parseYoutube (
31+ "https://www.youtube.com/watch?v=57rdbK4vmKE&list=PLmoRDY8IgE2Okxy4WWdP95RHXOTGzJfQs" ,
32+ ) ,
33+ ) ;
34+ await assertSnapshot (
35+ t ,
36+ parseYoutube (
37+ "https://music.youtube.com/watch?v=nj1cre2e6t0" ,
38+ ) ,
39+ ) ;
40+ await assertSnapshot (
41+ t ,
42+ parseYoutube (
43+ "https://youtu.be/nj1cre2e6t0" ,
44+ ) ,
45+ ) ;
46+ } ) ;
5047
51- /** Test invalid URL formats
52- * Verifies that the function correctly returns undefined for:
53- * - URLs from other services (e.g., Gyazo)
54- * - Non-URL strings (including Japanese text)
55- * - Similar but invalid domains (e.g., "yourtube.com")
56- * - Generic URLs
57- */
58- await t . step ( "is not" , async ( t ) => {
59- await assertSnapshot (
60- t ,
61- parseYoutube (
62- "https://gyazo.com/da78df293f9e83a74b5402411e2f2e01" ,
63- ) ,
64- ) ;
65- await assertSnapshot (
66- t ,
67- parseYoutube (
68- "test_text" ,
69- ) ,
70- ) ;
71- await assertSnapshot (
72- t ,
73- parseYoutube (
74- "https://yourtube.com/watch?v=rafere" ,
75- ) ,
76- ) ;
77- await assertSnapshot (
78- t ,
79- parseYoutube (
80- "https://example.com" ,
81- ) ,
82- ) ;
83- } ) ;
84- } ,
48+ /** Test invalid URL formats
49+ * Verifies that the function correctly returns undefined for:
50+ * - URLs from other services (e.g., Gyazo)
51+ * - Non-URL strings (including Japanese text)
52+ * - Similar but invalid domains (e.g., "yourtube.com")
53+ * - Generic URLs
54+ */
55+ await t . step ( "is not" , async ( t ) => {
56+ await assertSnapshot (
57+ t ,
58+ parseYoutube (
59+ "https://gyazo.com/da78df293f9e83a74b5402411e2f2e01" ,
60+ ) ,
61+ ) ;
62+ await assertSnapshot (
63+ t ,
64+ parseYoutube (
65+ "test_text" ,
66+ ) ,
67+ ) ;
68+ await assertSnapshot (
69+ t ,
70+ parseYoutube (
71+ "https://yourtube.com/watch?v=rafere" ,
72+ ) ,
73+ ) ;
74+ await assertSnapshot (
75+ t ,
76+ parseYoutube (
77+ "https://example.com" ,
78+ ) ,
79+ ) ;
80+ } ) ;
8581} ) ;
0 commit comments