@@ -70,6 +70,11 @@ describe('ExportTaxonomies', () => {
7070 fileName : 'taxonomies.json' ,
7171 invalidKeys : [ ] ,
7272 limit : 100
73+ } ,
74+ locales : {
75+ dirName : 'locales' ,
76+ fileName : 'locales.json' ,
77+ requiredKeys : [ 'code' , 'uid' , 'name' , 'fallback_locale' ]
7378 }
7479 }
7580 } as any ;
@@ -82,6 +87,7 @@ describe('ExportTaxonomies', () => {
8287
8388 sinon . stub ( FsUtility . prototype , 'writeFile' ) . resolves ( ) ;
8489 sinon . stub ( FsUtility . prototype , 'makeDirectory' ) . resolves ( ) ;
90+ sinon . stub ( FsUtility . prototype , 'readFile' ) . resolves ( { } ) ;
8591 } ) ;
8692
8793 afterEach ( ( ) => {
@@ -102,7 +108,7 @@ describe('ExportTaxonomies', () => {
102108 } ) ;
103109 } ) ;
104110
105- describe ( 'getAllTaxonomies () method' , ( ) => {
111+ describe ( 'fetchTaxonomies () method' , ( ) => {
106112 it ( 'should fetch and process taxonomies correctly' , async ( ) => {
107113 const taxonomies = [
108114 { uid : 'taxonomy-1' , name : 'Category' , invalidField : 'remove' } ,
@@ -118,15 +124,15 @@ describe('ExportTaxonomies', () => {
118124 } )
119125 } ) ;
120126
121- await exportTaxonomies . getAllTaxonomies ( ) ;
127+ await exportTaxonomies . fetchTaxonomies ( ) ;
122128
123129 // Verify taxonomies were processed
124130 expect ( Object . keys ( exportTaxonomies . taxonomies ) . length ) . to . equal ( 2 ) ;
125131 expect ( exportTaxonomies . taxonomies [ 'taxonomy-1' ] ) . to . exist ;
126132 expect ( exportTaxonomies . taxonomies [ 'taxonomy-1' ] . name ) . to . equal ( 'Category' ) ;
127133 } ) ;
128134
129- it ( 'should call getAllTaxonomies recursively when more taxonomies exist' , async ( ) => {
135+ it ( 'should call fetchTaxonomies recursively when more taxonomies exist' , async ( ) => {
130136 let callCount = 0 ;
131137 mockStackClient . taxonomy . returns ( {
132138 query : sinon . stub ( ) . returns ( {
@@ -147,7 +153,7 @@ describe('ExportTaxonomies', () => {
147153 } )
148154 } ) ;
149155
150- await exportTaxonomies . getAllTaxonomies ( ) ;
156+ await exportTaxonomies . fetchTaxonomies ( ) ;
151157
152158 // Verify multiple calls were made
153159 expect ( callCount ) . to . be . greaterThan ( 1 ) ;
@@ -159,7 +165,7 @@ describe('ExportTaxonomies', () => {
159165 const mockMakeAPICall = sinon . stub ( exportTaxonomies , 'makeAPICall' ) . resolves ( ) ;
160166 const writeFileStub = FsUtility . prototype . writeFile as sinon . SinonStub ;
161167
162- // Mock getAllTaxonomies to return one taxonomy
168+ // Mock fetchTaxonomies to return one taxonomy
163169 const mockTaxonomy = {
164170 uid : 'taxonomy-1' ,
165171 name : 'Category'
@@ -208,7 +214,7 @@ describe('ExportTaxonomies', () => {
208214 } ) ;
209215 } ) ;
210216
211- describe ( 'getAllTaxonomies () method - edge cases' , ( ) => {
217+ describe ( 'fetchTaxonomies () method - edge cases' , ( ) => {
212218 it ( 'should handle no items response and not process taxonomies' , async ( ) => {
213219 mockStackClient . taxonomy . returns ( {
214220 query : sinon . stub ( ) . returns ( {
@@ -220,7 +226,7 @@ describe('ExportTaxonomies', () => {
220226 } ) ;
221227
222228 const initialCount = Object . keys ( exportTaxonomies . taxonomies ) . length ;
223- await exportTaxonomies . getAllTaxonomies ( ) ;
229+ await exportTaxonomies . fetchTaxonomies ( ) ;
224230
225231 // Verify no new taxonomies were added
226232 expect ( Object . keys ( exportTaxonomies . taxonomies ) . length ) . to . equal ( initialCount ) ;
@@ -237,7 +243,7 @@ describe('ExportTaxonomies', () => {
237243 } ) ;
238244
239245 const initialCount = Object . keys ( exportTaxonomies . taxonomies ) . length ;
240- await exportTaxonomies . getAllTaxonomies ( ) ;
246+ await exportTaxonomies . fetchTaxonomies ( ) ;
241247
242248 // Verify no processing occurred with null items
243249 expect ( Object . keys ( exportTaxonomies . taxonomies ) . length ) . to . equal ( initialCount ) ;
@@ -250,7 +256,7 @@ describe('ExportTaxonomies', () => {
250256 } )
251257 } ) ;
252258
253- await exportTaxonomies . getAllTaxonomies ( ) ;
259+ await exportTaxonomies . fetchTaxonomies ( ) ;
254260
255261 // Verify method completes without throwing
256262 expect ( exportTaxonomies . taxonomies ) . to . exist ;
@@ -268,7 +274,7 @@ describe('ExportTaxonomies', () => {
268274 } )
269275 } ) ;
270276
271- await exportTaxonomies . getAllTaxonomies ( ) ;
277+ await exportTaxonomies . fetchTaxonomies ( ) ;
272278
273279 // Verify taxonomies were still processed despite undefined count
274280 expect ( exportTaxonomies . taxonomies [ 'taxonomy-1' ] ) . to . exist ;
0 commit comments