Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unit tests for ComicInfo and ComicBookInfo formats #70

Merged
merged 13 commits into from
Oct 18, 2023

Conversation

carif
Copy link
Contributor

@carif carif commented Nov 24, 2022

Add unit tests for the ComicInfo and ComicBookInfo format using xunit and NSubstitute. While adding the unit tests, I found a few bugs that I fixed as well.

The test data for the ComicBookInfo unit test is taken from the documentation of the format: https://code.google.com/archive/p/comicbookinfo/wikis/Example.wiki
The test data for the ComicInfo unit test is real data from an actual manga. There is one exception to this: The image size of the pages is an arbitrary chosen value instead of using the real image size (stored in bytes).

In either case, I provided more test data than is actually tested against. This should allow developers who do not own comics / mangas to contribute by testing their changes against the test data. This could serve as a reference to add missing fields to the Jellyfin Server to allow the plugin to save the entire metadata to the server and then let clients use those additional metadata fields for their own purposes (e.g. reading direction for manga).

No unit tests for the epub format as I ran out of time. :/

carif and others added 11 commits November 24, 2022 15:14
Based on the information provided by the Anansi Project, US comics do
use the field "AlternateSeries" to specify an alternate series when the
comic contains cross-over story-arcs. However, software like ComicTagger
use the same field to provide the original title of the manga.
Given a full language name like 'English', it is not possible to look up
the three letter iso language value for that name using CultureInfo.
Copy link

@ReenigneArcher ReenigneArcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw a comment in Discord about wanting a review. Mostly just looking for ideas for a PR (LizardByte/Themerr-jellyfin#101) I have on one of my plugins to add unit testing.

Noticed some out of date dependencies.

Maybe add an ability to log messages? From my very limited experience with xunit and dotnet test, the standard output from dotnet test is not helpful at all. I created a simple logger to use during testing. Then run with tests with dotnet test --logger "console;verbosity=detailed" to actually get some valuable output.

@carif
Copy link
Contributor Author

carif commented Sep 23, 2023

@cvium @ReenigneArcher Thx for the review. :)

Maybe add an ability to log messages? From my very limited experience with xunit and dotnet test, the standard output from dotnet test is not helpful at all. I created a simple logger to use during testing. Then run with tests with dotnet test --logger "console;verbosity=detailed" to actually get some valuable output.

I'm not sure we need logging for those simple tests, especially since the classes under test don't log anything (in the methods under test) anyway. Should we want to log something in those tests, xunit provides a way to do so without writing a custom log class: https://xunit.net/docs/capturing-output

@crobibero crobibero merged commit d68cb3c into jellyfin:master Oct 18, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants