@@ -40,17 +40,17 @@ describe("Terms Query API test cases", () => {
4040 } ) ;
4141
4242 it ( "should return terms for given locale when locale() is chained" , async ( ) => {
43- const result = await makeTerms ( "taxonomy_testing " ) . locale ( "hi-in " ) . find < TTerm > ( ) ;
43+ const result = await makeTerms ( "gadgets " ) . locale ( "fr-fr " ) . find < TTerm > ( ) ;
4444 expect ( result ) . toBeDefined ( ) ;
4545 } ) ;
4646
4747 it ( "should return terms with fallback when includeFallback() is chained" , async ( ) => {
48- const result = await makeTerms ( "taxonomy_testing " ) . includeFallback ( ) . find < TTerm > ( ) ;
48+ const result = await makeTerms ( "gadgets " ) . includeFallback ( ) . find < TTerm > ( ) ;
4949 expect ( result ) . toBeDefined ( ) ;
5050 } ) ;
5151
5252 it ( "should return localized terms with fallback when locale() and includeFallback() are chained" , async ( ) => {
53- const result = await makeTerms ( "taxonomy_testing " ) . locale ( "hi-in " ) . includeFallback ( ) . find < TTerm > ( ) ;
53+ const result = await makeTerms ( "gadgets " ) . locale ( "fr-fr " ) . includeFallback ( ) . find < TTerm > ( ) ;
5454 expect ( result ) . toBeDefined ( ) ;
5555 } ) ;
5656} ) ;
@@ -67,14 +67,14 @@ describe("Term Query API test cases - gadgets taxonomy", () => {
6767 const result = await stack . taxonomy ( "gadgets" ) . term ( ) . locale ( "en-us" ) . find < TTerm > ( ) ;
6868 expect ( result ) . toBeDefined ( ) ;
6969 expect ( result . terms ) . toBeDefined ( ) ;
70- expect ( result . terms . length ) . toBe ( 5 ) ;
71- const byUid = Object . fromEntries ( result . terms . map ( ( t : any ) => [ t . uid , t ] ) ) ;
70+ expect ( result . terms ! . length ) . toBe ( 5 ) ;
71+ const byUid = Object . fromEntries ( result . terms ! . map ( ( t : any ) => [ t . uid , t ] ) ) ;
7272 expect ( byUid [ "tablet" ] . name ) . toBe ( "Tablet" ) ;
7373 expect ( byUid [ "laptop" ] . name ) . toBe ( "Laptop" ) ;
7474 expect ( byUid [ "smartwatch" ] . name ) . toBe ( "Smartwatch" ) ;
7575 expect ( byUid [ "smartphone" ] . name ) . toBe ( "Smartphone" ) ;
7676 expect ( byUid [ "headphone" ] . name ) . toBe ( "Headphone" ) ;
77- result . terms . forEach ( ( t : any ) => expect ( t . locale ) . toBe ( "en-us" ) ) ;
77+ result . terms ! . forEach ( ( t : any ) => expect ( t . locale ) . toBe ( "en-us" ) ) ;
7878 } ) ;
7979
8080 // Case 2: locale=en-us, include_fallback=true
@@ -83,14 +83,14 @@ describe("Term Query API test cases - gadgets taxonomy", () => {
8383 const result = await stack . taxonomy ( "gadgets" ) . term ( ) . locale ( "en-us" ) . includeFallback ( ) . find < TTerm > ( ) ;
8484 expect ( result ) . toBeDefined ( ) ;
8585 expect ( result . terms ) . toBeDefined ( ) ;
86- expect ( result . terms . length ) . toBe ( 5 ) ;
87- const byUid = Object . fromEntries ( result . terms . map ( ( t : any ) => [ t . uid , t ] ) ) ;
86+ expect ( result . terms ! . length ) . toBe ( 5 ) ;
87+ const byUid = Object . fromEntries ( result . terms ! . map ( ( t : any ) => [ t . uid , t ] ) ) ;
8888 expect ( byUid [ "tablet" ] . name ) . toBe ( "Tablet" ) ;
8989 expect ( byUid [ "laptop" ] . name ) . toBe ( "Laptop" ) ;
9090 expect ( byUid [ "smartwatch" ] . name ) . toBe ( "Smartwatch" ) ;
9191 expect ( byUid [ "smartphone" ] . name ) . toBe ( "Smartphone" ) ;
9292 expect ( byUid [ "headphone" ] . name ) . toBe ( "Headphone" ) ;
93- result . terms . forEach ( ( t : any ) => expect ( t . locale ) . toBe ( "en-us" ) ) ;
93+ result . terms ! . forEach ( ( t : any ) => expect ( t . locale ) . toBe ( "en-us" ) ) ;
9494 } ) ;
9595
9696 // Case 3: locale=fr-fr, include_fallback=false
@@ -99,14 +99,14 @@ describe("Term Query API test cases - gadgets taxonomy", () => {
9999 const result = await stack . taxonomy ( "gadgets" ) . term ( ) . locale ( "fr-fr" ) . find < TTerm > ( ) ;
100100 expect ( result ) . toBeDefined ( ) ;
101101 expect ( result . terms ) . toBeDefined ( ) ;
102- expect ( result . terms . length ) . toBe ( 3 ) ;
103- const byUid = Object . fromEntries ( result . terms . map ( ( t : any ) => [ t . uid , t ] ) ) ;
102+ expect ( result . terms ! . length ) . toBe ( 3 ) ;
103+ const byUid = Object . fromEntries ( result . terms ! . map ( ( t : any ) => [ t . uid , t ] ) ) ;
104104 expect ( byUid [ "headphone" ] . name ) . toBe ( "Headphone-fr" ) ;
105105 expect ( byUid [ "smartphone" ] . name ) . toBe ( "Smartphone-fr" ) ;
106106 expect ( byUid [ "smartwatch" ] . name ) . toBe ( "Smartwatch-fr" ) ;
107107 expect ( byUid [ "tablet" ] ) . toBeUndefined ( ) ;
108108 expect ( byUid [ "laptop" ] ) . toBeUndefined ( ) ;
109- result . terms . forEach ( ( t : any ) => expect ( t . locale ) . toBe ( "fr-fr" ) ) ;
109+ result . terms ! . forEach ( ( t : any ) => expect ( t . locale ) . toBe ( "fr-fr" ) ) ;
110110 } ) ;
111111
112112 // Case 4: locale=fr-fr, include_fallback=true
@@ -115,8 +115,8 @@ describe("Term Query API test cases - gadgets taxonomy", () => {
115115 const result = await stack . taxonomy ( "gadgets" ) . term ( ) . locale ( "fr-fr" ) . includeFallback ( ) . find < TTerm > ( ) ;
116116 expect ( result ) . toBeDefined ( ) ;
117117 expect ( result . terms ) . toBeDefined ( ) ;
118- expect ( result . terms . length ) . toBe ( 5 ) ;
119- const byUid = Object . fromEntries ( result . terms . map ( ( t : any ) => [ t . uid , t ] ) ) ;
118+ expect ( result . terms ! . length ) . toBe ( 5 ) ;
119+ const byUid = Object . fromEntries ( result . terms ! . map ( ( t : any ) => [ t . uid , t ] ) ) ;
120120 expect ( byUid [ "headphone" ] . name ) . toBe ( "Headphone-fr" ) ;
121121 expect ( byUid [ "headphone" ] . locale ) . toBe ( "fr-fr" ) ;
122122 expect ( byUid [ "smartphone" ] . name ) . toBe ( "Smartphone-fr" ) ;
0 commit comments