These tests are designed to verify the functionality of the PeertubeVideosApi class, which interacts with the PeerTube API. Here's how they work:
Test "should return a list of videos, maximum 15 to default":
Verifies whether the getVideos() method returns a list of videos, limited to a maximum of 15 items by default.
Test "should return a list of videos, limited to maximum 5 when specified":
Checks if the getVideos() method limits the list of videos to a maximum of 5 items when specified.
Test "should return a list of videos, fetching maximum 3 per request when specified":
Ensures that the getVideos() method makes requests to the PeerTube API to retrieve videos in batches of 3, when specified.
Test "should return a list of videos, but not more than the total available videos":
Verifies that the getVideos() method does not return more videos than the total available videos.
Test "should return a list of videos, each with the properties indicated by the typing":
Checks if each video in the returned list has the correct structure according to the data types.
Test "should return a list of videos, each with a unique id":
Ensures that each video in the returned list has a unique identifier.
These tests provide verification of the core functionality and properties of the PeertubeVideosApi class, confirming its proper operation.
📷 Screenshots (if appropriate)
📦 Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
✅ Checklist (copied from README)
[x] Squash your changes into a single clear and thoroughly descriptive commit, split changes into multiple commits only when it contributes to readability
[x] Reference the GitHub issue that you are contributing on in your commit title or body
[x] Sign your commits, as this is required by the automated GitHub PR checks
[x] Ensure that the changes adhere to the project code style and formatting rules by running npx eslint . and npx prettier --check ../ from the ./OwnTube.tv/ directory (without errors/warnings)
[x] Include links and illustrations in your pull request to make it easy to review
[x] Request a review by @ar9708, @OGTor, @tryklick and @mblomdahl
🚀 Description
These changes satisfies the item no. 2 requirements in https://github.com/OwnTube-tv/.github/issues/8.
📄 Motivation and Context
🧪 How Has This Been Tested?
These tests are designed to verify the functionality of the PeertubeVideosApi class, which interacts with the PeerTube API. Here's how they work:
Test "should return a list of videos, maximum 15 to default": Verifies whether the getVideos() method returns a list of videos, limited to a maximum of 15 items by default. Test "should return a list of videos, limited to maximum 5 when specified": Checks if the getVideos() method limits the list of videos to a maximum of 5 items when specified. Test "should return a list of videos, fetching maximum 3 per request when specified": Ensures that the getVideos() method makes requests to the PeerTube API to retrieve videos in batches of 3, when specified. Test "should return a list of videos, but not more than the total available videos": Verifies that the getVideos() method does not return more videos than the total available videos. Test "should return a list of videos, each with the properties indicated by the typing": Checks if each video in the returned list has the correct structure according to the data types. Test "should return a list of videos, each with a unique id": Ensures that each video in the returned list has a unique identifier. These tests provide verification of the core functionality and properties of the PeertubeVideosApi class, confirming its proper operation.
📷 Screenshots (if appropriate)
📦 Types of changes
✅ Checklist (copied from README)
npx eslint .
andnpx prettier --check ../
from the./OwnTube.tv/
directory (without errors/warnings)