@@ -6,12 +6,35 @@ import {
66 RESERVED_PROJECT_NAMES ,
77 RuntimeVersionSchema ,
88 SDKFrameworkSchema ,
9+ TargetLanguageSchema ,
910 getSupportedModelProviders ,
1011 isModelProviderSupported ,
1112 isReservedProjectName ,
13+ matchEnumValue ,
1214} from '../constants.js' ;
1315import { describe , expect , it } from 'vitest' ;
1416
17+ describe ( 'matchEnumValue' , ( ) => {
18+ it ( 'returns canonical value for case-insensitive match' , ( ) => {
19+ expect ( matchEnumValue ( SDKFrameworkSchema , 'strands' ) ) . toBe ( 'Strands' ) ;
20+ expect ( matchEnumValue ( SDKFrameworkSchema , 'STRANDS' ) ) . toBe ( 'Strands' ) ;
21+ expect ( matchEnumValue ( SDKFrameworkSchema , 'Strands' ) ) . toBe ( 'Strands' ) ;
22+ expect ( matchEnumValue ( ModelProviderSchema , 'bedrock' ) ) . toBe ( 'Bedrock' ) ;
23+ expect ( matchEnumValue ( TargetLanguageSchema , 'python' ) ) . toBe ( 'Python' ) ;
24+ } ) ;
25+
26+ it ( 'returns undefined for non-matching input' , ( ) => {
27+ expect ( matchEnumValue ( SDKFrameworkSchema , 'nonexistent' ) ) . toBeUndefined ( ) ;
28+ expect ( matchEnumValue ( ModelProviderSchema , 'azure' ) ) . toBeUndefined ( ) ;
29+ } ) ;
30+
31+ it ( 'handles multi-word enum values' , ( ) => {
32+ expect ( matchEnumValue ( SDKFrameworkSchema , 'langchain_langgraph' ) ) . toBe ( 'LangChain_LangGraph' ) ;
33+ expect ( matchEnumValue ( SDKFrameworkSchema , 'openaiagents' ) ) . toBe ( 'OpenAIAgents' ) ;
34+ expect ( matchEnumValue ( SDKFrameworkSchema , 'googleadk' ) ) . toBe ( 'GoogleADK' ) ;
35+ } ) ;
36+ } ) ;
37+
1538describe ( 'SDKFrameworkSchema' , ( ) => {
1639 it . each ( [ 'Strands' , 'LangChain_LangGraph' , 'CrewAI' , 'GoogleADK' , 'OpenAIAgents' ] ) ( 'accepts "%s"' , framework => {
1740 expect ( SDKFrameworkSchema . safeParse ( framework ) . success ) . toBe ( true ) ;
0 commit comments