Commit 2212aa8
authored
test(inference): cover provider model validation failure and availability messages (#9281)
## What
The Gemini model-validation paths gained a dedicated test suite in
#6975, but the **Anthropic** and **NVIDIA Endpoints** paths emit the
same message contracts without direct tests — the exact gap the
repository's risky-path heuristic keeps noting for `inference` files.
## Changes
Five tests in `src/lib/inference/provider-models.test.ts`, each
asserting the **exact emitted strings** from
`src/lib/inference/provider-models.ts`:
| Behavior | Message contract |
|---|---|
| NVIDIA catalog-fetch failure | `Could not validate model against
{buildEndpointUrl}/models: {reason}` |
| Gemini availability miss | `Model '{model}' is not available from
Google Gemini. Checked {endpointUrl}.` |
| Anthropic availability miss | `Model '{model}' is not available from
Anthropic. Checked {endpointUrl}/v1/models.` |
| Anthropic catalog-fetch failure | `Could not validate model against
{endpointUrl}/v1/models: {reason}` |
| Anthropic 404/405 graceful gap | returns `{ ok: true, validated: false
}` |
The tests mirror the existing suite's style (injected
`runCurlProbeImpl`, `toEqual` assertions on the full result object).
## Verification
- `npx vitest run src/lib/inference/provider-models.test.ts` — **29/29
pass** (24 existing + 5 new)
- `npx oxlint` — 0 warnings, 0 errors
- `npx oxfmt` — applied and clean
Signed-off-by: Ashish Shrees <flowoker1@gmail.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Tests**
* Added coverage for provider model validation across NVIDIA, Gemini,
and Anthropic.
* Verified handling of catalog-fetch failures and missing models.
* Confirmed Anthropic 404 responses remain non-blocking.
* Ensured structured HTTP status details and endpoint-specific error
messages are preserved.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Signed-off-by: Ashish Shrees <flowoker1@gmail.com>1 parent 692d1fa commit 2212aa8
1 file changed
Lines changed: 109 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
704 | 705 | | |
705 | 706 | | |
706 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
707 | 816 | | |
708 | 817 | | |
709 | 818 | | |
| |||
0 commit comments