-
Couldn't load subscription status.
- Fork 2
Use ContentNode instead of AA for m.global + refactor tests
#116
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
Conversation
|
This pull request has merge conflicts. Please resolve the conflicts so the PR can be reviewed. Thanks! |
- Add 6 content node types in components/data/jellyfin/ - Add comprehensive unit tests (22 tests, all passing) - All nodes use explicit defaults and documented loading patterns
…session namespace to user/server
…al.server) and rename settings keys
…cleanups and add node helpers/docs
- Flatten test directory structure: tests/source/tests/* → tests/source/* - Move MockDataLoader to shared folder for better organization - Update build output path from build/staging to build across all configs - Update test configs to remove extends pattern and inline settings - Add new integration tests for settings migration and type conversion
- Add comprehensive migration system for registry keys (v1.1.0) - Migrate all settings from dotted names to camelCase (e.g., token → authToken) - Update registry accessors with test-mode detection for safe testing - Refactor JellyfinUserSettings for improved change tracking - Fix boolean type handling in display settings - Improve m.global reference patterns to minimize rendezvous - Update user poster caching with userId tracking
- Removed getSettingValue() helper and old dotted name fallback logic from SessionDataTransformer. - Removed tests for pre-migration states.
…nto content-nodes
- Remove 70+ redundant manual cleanup calls from integration tests - Update BaseTestSuite cleanup pattern from 'test-user-' to 'test-' - Fix beforeEach() field name bug (mockServer.url -> mockServer.serverUrl) - Add test-global baseline restoration in beforeEach() for API calls - Remove debug print statements from nodeUtils and session
|
I did a quick clean up of the unit tests and got all the tests passing for now to get this merged, but they could still use some love and there may still be some redundancies. |
Separates server-authoritative Configuration and Policy data into dedicated JellyfinUserConfiguration and JellyfinUserPolicy content nodes. This prevents registry tampering by automatically excluding node-type fields from registry loading. Changes: - Created JellyfinUserConfiguration and JellyfinUserPolicy content nodes - Updated JellyfinUser to use nested config and policy nodes - Modified SessionDataTransformer to create nested nodes - Updated session.bs to skip node-type fields from registry - Fixed initialization in globals.bs and user.Logout() - Updated all field access patterns (user.field → user.config.field) - Updated tests to reflect nested structure
Remove liveTvCanRecord and contentCanDelete from user settings and registry. These are server-authoritative permissions from the user policy API and should never be persisted locally. Changes: - Read enableLiveTvManagement directly from m.global.user.policy in ProgramDetails - Delete LoadUserAbilities() function that incorrectly wrote policy to registry - Remove policy fields from JellyfinUserSettings content node - Add migration to delete stale policy keys from registry - Update all tests and mock data
Replace m.global associative arrays with ContentNode implementations: - m.global.app -> AppInfo ContentNode - m.global.device -> DeviceInfo ContentNode - m.global.constants -> Constants ContentNode Flattened constants structure (colors.primary -> colorPrimary, icons.* -> icon*, font_sizes.* -> fontSize*). Enhanced DeviceInfo with additional system fields (uuid, osVersion, locale, display info).
…ault These only need to be run once before release
- Move migration tests to tests/source/integration/migration/ - Move registry I/O tests to tests/source/integration/registry/ - Extract round-trip tests from TypeConversion to RoundTripConversion - Tag migration and registry suites for selective test execution - Configure test runners to exclude migration and registry tests by default This improves daily development workflow by excluding slow I/O tests, while allowing comprehensive testing before releases.
ContentNodes instead of AA to hold global data + moreContentNode instead of AA for m.global + refactor tests
- Add needsRegistrySetup flag to BaseTestSuite (default: false) - Make registry I/O in beforeEach/afterEach/teardown conditional - Integration tests opt-in by setting needsRegistrySetup = true - Remove legacy globalRememberMe cleanup from setup() This eliminates 180+ file I/O operations per unit test run, significantly improving test performance.
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.
Pull Request Overview
This PR represents a comprehensive refactoring of the test infrastructure from an old unit-tests directory structure to a new, more organized three-tier testing approach (unit, integration, e2e). The changes include:
- Migration of existing tests from
unit-tests/source/tests/to a newtests/source/structure - Consolidation of multiple small test files into larger, more maintainable test suites
- Addition of extensive new tests for data transformers, content nodes, session management, and registry operations
- Enhancement of the
toBoolean()utility function to support case-insensitive string conversions - Bug fixes in subtitle handling code
Reviewed Changes
Copilot reviewed 253 out of 253 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
unit-tests/source/tests/utils/misc/*.spec.bs |
Removed old individual test files for validation utilities |
unit-tests/source/BaseTestSuite.spec.bs |
Removed old minimal base test suite |
tests/source/unit/utils/misc.spec.bs |
Consolidated validation utility tests into single comprehensive suite |
tests/source/unit/utils/misc-toBoolean.spec.bs |
New tests for boolean conversion including bug fix validation |
tests/source/unit/utils/misc-regex.spec.bs |
New tests for regex and URL parsing utilities |
tests/source/unit/utils/*.spec.bs |
New tests for display settings, session management, transformers |
tests/source/shared/*.bs |
New shared test utilities (MockDataLoader, RegistryTestUtils) |
tests/source/mocks/**/*.json |
New comprehensive mock data structure |
tests/source/integration/**/*.spec.bs |
New integration tests for registry, migrations, type conversion |
tests/source/BaseTestSuite.spec.bs |
New comprehensive base test suite with proper setup/teardown |
tests/source/*/README.md |
New documentation for test categories |
source/utils/misc.bs |
Enhanced toBoolean() for case-insensitive conversion |
source/utils/Subtitles.bs |
Optimized to reduce rendezvous with main thread |
|
@copilot can you review the changes regarding |
This should have been a few separate PRs. Scope creep got me hard on this one. I'll do my best to list all the changes.
Changes
sessioncontainer fromm.globalm.globalvarsdisplay.settings, from the old dotted pattern to the new camelCase pattern i.e.itemgrid.movieDefaultView->itemGridMovieDefaultView1.1.0to activate registry migrationsbuild/instead ofbuild/staging/Issues
Fixes #105
Ref #103
Unit tests
By default, all tests tagged as
registryormigrationare excluded. These are time consuming, rough on the testing device, and only need to be run once before release. Manually empty the tags array from the bsconfig to run all tests"tags": ["!migration", "!registry"].Only unit
Only Integration
All unit tests excluding
migrationandregistrytagsALL unit tests