Skip to content

[Tests] AISettingsProvider — test DB→config→env→throw fallback chain #103

@fboucheros

Description

@fboucheros

What to build

AISettingsProvider.GetAISettingsAsync() contains non-trivial fallback logic (DB Settings → IConfiguration → environment variable → throw) with zero tests. Add unit tests for each branch.

Acceptance criteria

  • Test: API key found in DB Settings.AiApiKey → returned successfully
  • Test: DB key absent → falls back to IConfiguration value → returned successfully
  • Test: DB + config absent → falls back to environment variable → returned successfully
  • Test: all three sources absent → throws expected exception
  • Mocks use IDataStorageService and IConfiguration (no real infrastructure needed)
  • All new tests pass in CI

Blocked by

None — can start immediately.

Priority

🔴 Critical — fallback logic is critical for configuration correctness

Metadata

Metadata

Assignees

No one assigned

    Labels

    squad:linusAssigned to Linus (🧪 Tester)test

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions