-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Conversation
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.
Jellyfin.Plugin.Bookshelf/Providers/ComicBookInfo/ComicBookInfoProvider.cs
Show resolved
Hide resolved
Jellyfin.Plugin.Bookshelf/Providers/ComicBookInfo/ComicBookInfoProvider.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
tests/Jellyfin.Plugin.Bookshelf.Tests/Jellyfin.Plugin.Bookshelf.Tests.csproj
Outdated
Show resolved
Hide resolved
@cvium @ReenigneArcher Thx for the review. :)
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 |
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. :/