Skip to content

Commit a003b14

Browse files
fix: add missing commas in test function blocks
1 parent 8b96831 commit a003b14

File tree

3 files changed

+181
-178
lines changed

3 files changed

+181
-178
lines changed

parser/spotify.test.ts

Lines changed: 63 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -9,67 +9,68 @@ Deno.test({
99
name: "spotify links",
1010
ignore: true,
1111
fn: async (t) => {
12-
/** Test valid Spotify URLs for different content types
13-
* - Track URLs: /track/{id}
14-
* - Album URLs: /album/{id}
15-
* - Episode URLs: /episode/{id} (podcasts)
16-
* - Playlist URLs: /playlist/{id}
17-
* Each URL may optionally include query parameters
18-
*/
19-
await t.step("is", async (t) => {
20-
await assertSnapshot(
21-
t,
22-
parseSpotify("https://open.spotify.com/track/0rlYL6IQIwLZwYIguyy3l0"),
23-
);
24-
await assertSnapshot(
25-
t,
26-
parseSpotify("https://open.spotify.com/album/1bgUOjg3V0a7tvEfF1N6Kk"),
27-
);
28-
await assertSnapshot(
29-
t,
30-
parseSpotify(
31-
"https://open.spotify.com/episode/0JtPGoprZK2WlYMjhFF2xD?si=1YLMdgNpSHOuWkaEmCAQ0g",
32-
),
33-
);
34-
await assertSnapshot(
35-
t,
36-
parseSpotify(
37-
"https://open.spotify.com/playlist/2uOyQytSjDq9GF5z1RJj5w?si=e73cac2a2a294f7a",
38-
),
39-
);
40-
});
12+
/** Test valid Spotify URLs for different content types
13+
* - Track URLs: /track/{id}
14+
* - Album URLs: /album/{id}
15+
* - Episode URLs: /episode/{id} (podcasts)
16+
* - Playlist URLs: /playlist/{id}
17+
* Each URL may optionally include query parameters
18+
*/
19+
await t.step("is", async (t) => {
20+
await assertSnapshot(
21+
t,
22+
parseSpotify("https://open.spotify.com/track/0rlYL6IQIwLZwYIguyy3l0"),
23+
);
24+
await assertSnapshot(
25+
t,
26+
parseSpotify("https://open.spotify.com/album/1bgUOjg3V0a7tvEfF1N6Kk"),
27+
);
28+
await assertSnapshot(
29+
t,
30+
parseSpotify(
31+
"https://open.spotify.com/episode/0JtPGoprZK2WlYMjhFF2xD?si=1YLMdgNpSHOuWkaEmCAQ0g",
32+
),
33+
);
34+
await assertSnapshot(
35+
t,
36+
parseSpotify(
37+
"https://open.spotify.com/playlist/2uOyQytSjDq9GF5z1RJj5w?si=e73cac2a2a294f7a",
38+
),
39+
);
40+
});
4141

42-
/** Test invalid URLs and non-Spotify content
43-
* Verifies that the function returns undefined for:
44-
* - URLs from other services (e.g., Gyazo)
45-
* - Plain text that looks like URLs
46-
* - URLs with similar patterns but from different domains
47-
* - Generic URLs
48-
*/
49-
await t.step("is not", async (t) => {
50-
await assertSnapshot(
51-
t,
52-
parseSpotify(
53-
"https://gyazo.com/da78df293f9e83a74b5402411e2f2e01",
54-
),
55-
);
56-
await assertSnapshot(
57-
t,
58-
parseSpotify(
59-
"ほげほげ",
60-
),
61-
);
62-
await assertSnapshot(
63-
t,
64-
parseSpotify(
65-
"https://yourtube.com/watch?v=rafere",
66-
),
67-
);
68-
await assertSnapshot(
69-
t,
70-
parseSpotify(
71-
"https://example.com",
72-
),
73-
);
74-
});
42+
/** Test invalid URLs and non-Spotify content
43+
* Verifies that the function returns undefined for:
44+
* - URLs from other services (e.g., Gyazo)
45+
* - Plain text that looks like URLs
46+
* - URLs with similar patterns but from different domains
47+
* - Generic URLs
48+
*/
49+
await t.step("is not", async (t) => {
50+
await assertSnapshot(
51+
t,
52+
parseSpotify(
53+
"https://gyazo.com/da78df293f9e83a74b5402411e2f2e01",
54+
),
55+
);
56+
await assertSnapshot(
57+
t,
58+
parseSpotify(
59+
"ほげほげ",
60+
),
61+
);
62+
await assertSnapshot(
63+
t,
64+
parseSpotify(
65+
"https://yourtube.com/watch?v=rafere",
66+
),
67+
);
68+
await assertSnapshot(
69+
t,
70+
parseSpotify(
71+
"https://example.com",
72+
),
73+
);
74+
});
75+
},
7576
});

parser/youtube.test.ts

Lines changed: 72 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -9,76 +9,77 @@ Deno.test({
99
name: "youtube links",
1010
ignore: true,
1111
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-
});
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+
});
5050

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-
});
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+
},
8485
});

rest/getCodeBlocks.test.ts

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -238,53 +238,54 @@ Deno.test({
238238
name: "getCodeBlocks()",
239239
ignore: true,
240240
fn: async (t) => {
241-
// Test the basic functionality of getCodeBlocks
242-
// This verifies that all code blocks are correctly extracted from the page
243-
await assertSnapshot(
244-
t,
245-
getCodeBlocks({ project, title, lines: sample }),
246-
);
241+
// Test the basic functionality of getCodeBlocks
242+
// This verifies that all code blocks are correctly extracted from the page
243+
await assertSnapshot(
244+
t,
245+
getCodeBlocks({ project, title, lines: sample }),
246+
);
247247

248-
// Test filtering code blocks by filename
249-
// This ensures that we can retrieve specific code blocks by their filename
250-
await t.step("filename filter", async (st) => {
251-
const filename = "インデント.md";
252-
const codeBlocks = getCodeBlocks({ project, title, lines: sample }, {
253-
filename,
248+
// Test filtering code blocks by filename
249+
// This ensures that we can retrieve specific code blocks by their filename
250+
await t.step("filename filter", async (st) => {
251+
const filename = "インデント.md";
252+
const codeBlocks = getCodeBlocks({ project, title, lines: sample }, {
253+
filename,
254+
});
255+
const yet = [];
256+
for (const codeBlock of codeBlocks) {
257+
yet.push(assertEquals(codeBlock.filename, filename));
258+
}
259+
await Promise.all(yet);
260+
await assertSnapshot(st, codeBlocks);
254261
});
255-
const yet = [];
256-
for (const codeBlock of codeBlocks) {
257-
yet.push(assertEquals(codeBlock.filename, filename));
258-
}
259-
await Promise.all(yet);
260-
await assertSnapshot(st, codeBlocks);
261-
});
262-
// Test filtering code blocks by programming language
263-
// This verifies that we can find all code blocks of a specific language
264-
await t.step("language name filter", async (st) => {
265-
const lang = "py";
266-
const codeBlocks = getCodeBlocks({ project, title, lines: sample }, {
267-
lang,
262+
// Test filtering code blocks by programming language
263+
// This verifies that we can find all code blocks of a specific language
264+
await t.step("language name filter", async (st) => {
265+
const lang = "py";
266+
const codeBlocks = getCodeBlocks({ project, title, lines: sample }, {
267+
lang,
268+
});
269+
const yet = [];
270+
for (const codeBlock of codeBlocks) {
271+
yet.push(assertEquals(codeBlock.lang, lang));
272+
}
273+
await Promise.all(yet);
274+
await assertSnapshot(st, codeBlocks);
268275
});
269-
const yet = [];
270-
for (const codeBlock of codeBlocks) {
271-
yet.push(assertEquals(codeBlock.lang, lang));
272-
}
273-
await Promise.all(yet);
274-
await assertSnapshot(st, codeBlocks);
275-
});
276-
// Test filtering code blocks by their title line ID
277-
// This ensures we can find code blocks starting at a specific line in the page
278-
await t.step("title line ID filter", async (st) => {
279-
const titleLineId = "63b7b1261280f00000c9bc34";
280-
const codeBlocks = getCodeBlocks({ project, title, lines: sample }, {
281-
titleLineId,
276+
// Test filtering code blocks by their title line ID
277+
// This ensures we can find code blocks starting at a specific line in the page
278+
await t.step("title line ID filter", async (st) => {
279+
const titleLineId = "63b7b1261280f00000c9bc34";
280+
const codeBlocks = getCodeBlocks({ project, title, lines: sample }, {
281+
titleLineId,
282+
});
283+
const yet = [];
284+
for (const codeBlock of codeBlocks) {
285+
yet.push(assertEquals(codeBlock.titleLine.id, titleLineId));
286+
}
287+
await Promise.all(yet);
288+
await assertSnapshot(st, codeBlocks);
282289
});
283-
const yet = [];
284-
for (const codeBlock of codeBlocks) {
285-
yet.push(assertEquals(codeBlock.titleLine.id, titleLineId));
286-
}
287-
await Promise.all(yet);
288-
await assertSnapshot(st, codeBlocks);
289-
});
290+
},
290291
});

0 commit comments

Comments
 (0)