@@ -4,12 +4,15 @@ import { HttpClient } from '../HttpClient';
44import { registerHandlebarHelpers } from './registerHandlebarHelpers' ;
55
66describe ( 'registerHandlebarHelpers' , ( ) => {
7- it ( 'should register the helpers' , ( ) => {
7+ beforeEach ( ( ) => {
88 registerHandlebarHelpers ( {
99 httpClient : HttpClient . FETCH ,
1010 useOptions : false ,
1111 useUnionTypes : false ,
1212 } ) ;
13+ } ) ;
14+
15+ it ( 'should register the helpers' , ( ) => {
1316 const helpers = Object . keys ( Handlebars . helpers ) ;
1417 expect ( helpers ) . toContain ( 'ifdef' ) ;
1518 expect ( helpers ) . toContain ( 'equals' ) ;
@@ -22,4 +25,29 @@ describe('registerHandlebarHelpers', () => {
2225 expect ( helpers ) . toContain ( 'escapeDescription' ) ;
2326 expect ( helpers ) . toContain ( 'camelCase' ) ;
2427 } ) ;
28+
29+ it ( 'should render single-value nested enums as enum members' , ( ) => {
30+ const result = Handlebars . helpers . enumerator (
31+ [ { name : 'CURATOR_LIST' , value : "'curator_list'" , type : 'string' , description : null } ] ,
32+ 'PlayerGgFollowTarget' ,
33+ 'kind' ,
34+ { fn : ( value : string ) => value }
35+ ) ;
36+
37+ expect ( result ) . toBe ( 'PlayerGgFollowTarget.kind.CURATOR_LIST' ) ;
38+ } ) ;
39+
40+ it ( 'should render multi-value nested enums as enum types' , ( ) => {
41+ const result = Handlebars . helpers . enumerator (
42+ [
43+ { name : 'GAME' , value : "'game'" , type : 'string' , description : null } ,
44+ { name : 'CURATOR_LIST' , value : "'curator_list'" , type : 'string' , description : null } ,
45+ ] ,
46+ 'PlayerGgFollowTarget' ,
47+ 'kind' ,
48+ { fn : ( value : string ) => value }
49+ ) ;
50+
51+ expect ( result ) . toBe ( 'PlayerGgFollowTarget.kind' ) ;
52+ } ) ;
2553} ) ;
0 commit comments