fix(tests): replace short playlist, add new pop genre id

This commit is contained in:
ThetaDev 2023-08-04 01:14:36 +02:00
parent 57086cab9a
commit b752b6ea9b
3 changed files with 33 additions and 15 deletions

View file

@ -7,14 +7,6 @@ unittest:
testyt: testyt:
cargo test --features=rss --test youtube cargo test --features=rss --test youtube
testyt10:
#!/usr/bin/env bash
set -e
for i in {1..10}; do \
echo "---TEST RUN $i---"; \
cargo test --features=rss --test youtube; \
done
testintl: testintl:
#!/usr/bin/env bash #!/usr/bin/env bash
LANGUAGES=( LANGUAGES=(
@ -47,4 +39,4 @@ testfiles:
report2yaml: report2yaml:
mkdir -p rustypipe_reports/conv mkdir -p rustypipe_reports/conv
for f in rustypipe_reports/*.json; do yq '.http_request.resp_body' $f | yq -o json -P > rustypipe_reports/conv/`basename $f .json`_body.json; yq e -Pi $f; mv $f rustypipe_reports/conv/`basename $f .json`.yaml; done; for f in rustypipe_reports/*.json; do yq '.http_request.resp_body' $f | yq -o json -P > rustypipe_reports/conv/`basename $f .json`_body.json; yq e -Pi "del(.http_request.resp_body)" $f; mv $f rustypipe_reports/conv/`basename $f .json`.yaml; done;

View file

@ -154,3 +154,29 @@ Subscribers: 1780000
[6Fv8bd9ICb4] Who owns this? (199s) [6Fv8bd9ICb4] Who owns this? (199s)
... ...
``` ```
## Development
**Requirements:**
- Current version of stable Rust
- [`just`](https://github.com/casey/just) task runner
- [`pre-commit`](https://pre-commit.com/)
- yq (YAML processor)
### Tasks
**Testing**
- `just test` Run unit+integration tests
- `just unittest` Run unit tests
- `just testyt` Run YouTube integration tests
- `just testintl` Run YouTube integration tests for all supported languages (this takes
a long time and is therefore not run in CI)
- `YT_LANG=de just testyt` Run YouTube integration tests for a specific language
**Tools**
- `just testfiles` Download missing testfiles for unit tests
- `just report2yaml` Convert RustyPipe reports into a more readable yaml format
(requires `yq`)

View file

@ -1278,10 +1278,10 @@ fn trending(rp: RustyPipe) {
false, false,
)] )]
#[case::short( #[case::short(
"RDCLAK5uy_kFQXdnqMaQCVx2wpUM4ZfbsGCDibZtkJk", "RDCLAK5uy_nLNY4ReQKH2kx5U23cyGMHql9ciHD9RSM",
"Easy Pop", "Presenting BLACKPINK (블랙핑크)",
false, false,
Some("Stress-free tunes from classic rockers and newer artists.\nThis playlist is no longer being updated.".to_owned()), Some("The most played hits and essential tracks. #blackpink #best #kpop".to_owned()),
None, None,
true true
)] )]
@ -2181,7 +2181,7 @@ fn music_genres(rp: RustyPipe, unlocalized: bool) {
let chill = genres let chill = genres
.iter() .iter()
.find(|g| g.id == "ggMPOg1uX1JOQWZFeDByc2Jm") .find(|g| g.id == "ggMPOg1uX1JOQWZFeDByc2Jm")
.unwrap(); .expect("genre: Chill");
if unlocalized { if unlocalized {
assert_eq!(chill.name, "Chill"); assert_eq!(chill.name, "Chill");
} }
@ -2189,8 +2189,8 @@ fn music_genres(rp: RustyPipe, unlocalized: bool) {
let pop = genres let pop = genres
.iter() .iter()
.find(|g| g.id == "ggMPOg1uX1lMbVZmbzl6NlJ3") .find(|g| g.id == "ggMPOg1uX1lMbVZmbzl6NlJ3" || g.id == "ggMPOg1uX1BmNzc2V2p0YXJ5")
.unwrap(); .expect("genre: Pop");
assert_eq!(pop.name, "Pop"); assert_eq!(pop.name, "Pop");
assert!(!pop.is_mood); assert!(!pop.is_mood);