Skip to content

Commit ff9e86a

Browse files
authored
Merge pull request #1656 from fturmel/PR/improve-content-testing-videoId
Improve content test for `videoId` field
2 parents 2aa3496 + a50f243 commit ff9e86a

File tree

34 files changed

+11
-37
lines changed

34 files changed

+11
-37
lines changed

content-testing/schemas.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ const baseVideosSchema = strictObject({
2121
title: string().required(),
2222
description: string().required(),
2323

24-
videoId: youtubeIdValidator.when(['parts'], (parts, schema) => {
24+
videoId: youtubeIdValidator.when('parts', ([parts], schema) => {
2525
// videoId required if the `parts` array is missing or empty
26-
return parts && parts.length > 0 ? schema : schema.required();
26+
return parts && parts.length > 0
27+
? schema.test(
28+
'videoId and parts conflict',
29+
'Top-level "videoId" should not be defined if "parts" exist',
30+
(value) => value === undefined
31+
)
32+
: schema.required();
2733
}),
2834

2935
nebulaSlug: nonUrlStringValidator,

content/videos/challenges/10-dfs-maze-generator/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Maze Generator",
33
"description": "Choo choo! In this multi-part coding challenge, I create a maze generator using a depth-first search algorithm with recursive backtracking. The idea is to walk through a grid of cells, removing walls as we go to build a maze.",
44
"videoNumber": "10",
5-
"videoId": "",
65
"date": "2016-05-02",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["maze", "recursion", "backtracking", "depth-first search"],

content/videos/challenges/100-neuroevolution-flappy-bird/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Neuroevolution Flappy Bird",
33
"description": "In this challenge, I use my JavaScript neural network library and a genetic algorithm to train an agent to play Flappy Bird.",
44
"videoNumber": "100",
5-
"videoId": "c6y21FkaUqw",
65
"date": "2018-04-16",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["neural network", "reinforcement learning", "genetic algorithms", "evolution", "Flappy Bird game"],

content/videos/challenges/110-recamans-sequence/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Recamán's Sequence",
33
"description": "In this coding challenge, I visualize the Recamán’s number sequence using the p5.js library and go on to generate a series of musical tones using p5.js sound.",
44
"videoNumber": "110",
5-
"videoId": "",
65
"date": "2018-07-24",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["number sequence", "Recamán's sequence", "music", "audio-visual", "visualization"],

content/videos/challenges/121-logo-interpreter/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Logo Interpreter",
33
"description": "In this coding challenge, I discuss turtle graphics and make a Logo Interpreter in JavaScript.",
44
"videoNumber": "121",
5-
"videoId": "",
65
"date": "2018-10-31",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["Logo", "Logo interpreter", "turtle graphics"],

content/videos/challenges/122-quick-draw/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Quick, Draw!",
33
"description": "In this multi-part coding challenge, I take a closer look at the Quick, Draw! dataset and create a simple node API to \"replay\" drawings of rainbows and cats using p5.js.",
44
"videoNumber": "122",
5-
"videoId": "",
65
"date": "2018-11-19",
76
"languages": ["p5.js", "Node.js", "JavaScript"],
87
"topics": ["Quick, Draw! game", "machine learning (ML)", "doodle classifiers", "sketch-RNN"],

content/videos/challenges/123-chaos-game/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Chaos Game",
33
"description": "In this multi-part coding challenge, I visualize the \"Chaos Game\".",
44
"videoNumber": "123",
5-
"videoId": "",
65
"date": "2018-11-29",
76
"languages": ["p5.js", "JavaScript"],
87
"topics": ["chaos game", "fractal", "seed points", "probability"],

content/videos/challenges/130-drawing-with-fourier-transform-and-epicycles/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Drawing with Fourier Transform and Epicycles",
33
"description": "In this coding challenge, I implement the Discrete Fourier Transform algorithm in JavaScript and render a drawing using epicycles derived from the transform.",
44
"videoNumber": "130",
5-
"videoId": "MY4luNgGfms",
65
"date": "2019-01-24",
76
"languages": ["JavaScript", "p5.js"],
87
"topics": ["Fourier transform square wave", "discrete Fourier transform", "epicycles drawing"],

content/videos/challenges/134-heart-curve/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Heart Curve",
33
"description": "In this multi-part challenge, I use a parametric equation (from Wolfram Mathworld) to draw a heart curve in Processing (Java).",
44
"videoNumber": "134",
5-
"videoId": "",
65
"date": "2019-02-18",
76
"languages": ["Processing"],
87
"topics": ["heart curve", "parametric equation", "polar coordinates", "GIF loop"],

content/videos/challenges/136-polar-noise-loops/index.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Polar Noise Loops",
33
"description": "In this multi-part coding challenge I show how to use a noise field and polar coordinates to create a perfect GIF loop.",
44
"videoNumber": "136",
5-
"videoId": "",
65
"date": "2019-02-25",
76
"languages": ["p5.js", "Processing"],
87
"topics": ["GIF loop", "Perlin noise", "polar coordinates"],

0 commit comments

Comments
 (0)