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:
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:
#!/usr/bin/env bash
LANGUAGES=(
@ -47,4 +39,4 @@ testfiles:
report2yaml:
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)
...
```
## 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,
)]
#[case::short(
"RDCLAK5uy_kFQXdnqMaQCVx2wpUM4ZfbsGCDibZtkJk",
"Easy Pop",
"RDCLAK5uy_nLNY4ReQKH2kx5U23cyGMHql9ciHD9RSM",
"Presenting BLACKPINK (블랙핑크)",
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,
true
)]
@ -2181,7 +2181,7 @@ fn music_genres(rp: RustyPipe, unlocalized: bool) {
let chill = genres
.iter()
.find(|g| g.id == "ggMPOg1uX1JOQWZFeDByc2Jm")
.unwrap();
.expect("genre: Chill");
if unlocalized {
assert_eq!(chill.name, "Chill");
}
@ -2189,8 +2189,8 @@ fn music_genres(rp: RustyPipe, unlocalized: bool) {
let pop = genres
.iter()
.find(|g| g.id == "ggMPOg1uX1lMbVZmbzl6NlJ3")
.unwrap();
.find(|g| g.id == "ggMPOg1uX1lMbVZmbzl6NlJ3" || g.id == "ggMPOg1uX1BmNzc2V2p0YXJ5")
.expect("genre: Pop");
assert_eq!(pop.name, "Pop");
assert!(!pop.is_mood);