Skip to content

Conversation

@abckhush
Copy link
Contributor

@abckhush abckhush commented Feb 5, 2026

Adds unit tests for AIClientFactory covering:

  • Client creation for OpenAI, Anthropic, and Gemini
  • Auto-selection and explicit provider selection logic
  • Provider priority behaviour
  • Custom endpoint handling
  • Error cases (missing API key, invalid provider, empty config)

All 108 tests pass.

Note:
Parameterised function used for FailsWhenApiKeyMissingForAllProviders and FailsWithEmptyConfigurationForAllProviders; rest are all explicitly defined.

Fixes: #47

@abckhush abckhush requested a review from benodiwal as a code owner February 5, 2026 07:36
}
}

TEST_F(AIClientFactoryTest, FailsOnInvalidProvider) {
Copy link
Owner

Choose a reason for hiding this comment

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

FailsOnInvalidProvider expects success=true ?
Doesn't seem to be right

EXPECT_TRUE(result.success);
}

TEST_F(AIClientFactoryTest, FailsWithEmptyConfigurationForAllProviders) {
Copy link
Owner

Choose a reason for hiding this comment

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

Same here


EXPECT_TRUE(result.success) << "Provider: " << static_cast<int>(provider);
}
} No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a new line at end of file please.
https://gist.github.com/OleksiyRudenko/d51388345ea55767b7672307fe35adf3

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.

Add tests for AI client factory

2 participants