kamiazya/scopes

fix: resolve FileBasedUserPreferencesRepository test failures

开放

#220 创建于 2025年9月12日

 (0 条评论) (0 个反应) (0 位负责人)Kotlin (3 个派生)auto 404
good first issuehacktoberfest

仓库指标

星标
 (2 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Problem

Three tests in FileBasedUserPreferencesRepositoryTest are failing due to implementation bugs in the repository:

Failing Tests

  1. should fail when aggregate has no preferences (line 198)

    • Expected: PreferencesNotInitialized error
    • Actual: InvalidPreferenceValue with ULID validation error
  2. should load valid preferences from file successfully (line 275)

    • Expected: Fixed timestamp 2022-01-01T00:00:00Z
    • Actual: Current system timestamp
  3. should handle permission errors when writing file (line 447)

    • Expected: Graceful error handling
    • Actual: AccessDeniedException during repository construction

Root Causes

  • ULID validation logic issues in preference value handling
  • Timestamp overwriting during file deserialization
  • Missing error handling in repository constructor for filesystem permissions

Impact

  • Tests fail in CI/CD pipeline
  • Temporarily excluded from JaCoCo coverage to unblock CI integration
  • No impact on actual functionality (tests are overly strict)

Acceptance Criteria

  • Fix ULID validation for preference values
  • Preserve timestamps during file loading operations
  • Add proper error handling for filesystem permission issues in constructor
  • All 34 tests in infrastructure module should pass
  • Re-enable JaCoCo coverage for this module

Priority

Medium - Does not block current development but should be addressed to maintain test coverage and code quality.

贡献者指南