11/**
22 * Branch Alias API Tests
3- *
3+ *
44 * Comprehensive test suite for:
55 * - Branch alias CRUD operations
66 * - Branch alias query operations
1111import { expect } from 'chai'
1212import { describe , it , before , after } from 'mocha'
1313import { contentstackClient } from '../utility/ContentstackClient.js'
14- import { testData , wait , shortId , trackedExpect } from '../utility/testHelpers.js'
14+ import { testData , wait , trackedExpect } from '../utility/testHelpers.js'
1515
1616describe ( 'Branch Alias API Tests' , ( ) => {
1717 let client
@@ -34,7 +34,7 @@ describe('Branch Alias API Tests', () => {
3434 testBranchUid = 'main'
3535 console . log ( 'Branch Alias tests using main branch (no branch in testData)' )
3636 }
37-
37+
3838 // Wait for any pending operations
3939 await wait ( 1000 )
4040 } )
@@ -49,31 +49,30 @@ describe('Branch Alias API Tests', () => {
4949 // ==========================================================================
5050
5151 describe ( 'Branch Alias CRUD' , ( ) => {
52-
5352 it ( 'should create a branch alias' , async function ( ) {
5453 this . timeout ( 45000 )
5554
5655 // Generate short alias uid (max 15 chars, lowercase alphanumeric and underscore only)
5756 // Format: branchUid + '_alias' (similar to old test pattern)
5857 testAliasUid = `${ testBranchUid } _alias` . slice ( 0 , 15 )
59-
58+
6059 // If using main branch, use a unique alias name
6160 if ( testBranchUid === 'main' ) {
6261 testAliasUid = `main_al_${ Date . now ( ) . toString ( ) . slice ( - 5 ) } `
6362 }
6463
6564 console . log ( `Creating alias "${ testAliasUid } " for branch "${ testBranchUid } "` )
66-
65+
6766 // Create the branch alias using SDK method (same as old tests)
6867 const response = await stack . branchAlias ( testAliasUid ) . createOrUpdate ( testBranchUid )
6968
7069 trackedExpect ( response , 'Branch alias' ) . toBeAn ( 'object' )
71-
70+
7271 // Validate response matches old test expectations
7372 trackedExpect ( response . uid , 'Branch alias uid' ) . toEqual ( testBranchUid )
7473 trackedExpect ( response . alias , 'Branch alias alias' ) . toEqual ( testAliasUid )
7574 expect ( response . urlPath ) . to . equal ( `/stacks/branches/${ testBranchUid } ` )
76-
75+
7776 // Store for later tests
7877 testData . branchAliases = testData . branchAliases || { }
7978 testData . branchAliases . test = response
@@ -113,12 +112,16 @@ describe('Branch Alias API Tests', () => {
113112 query : { uid : testBranchUid }
114113 } )
115114
115+ // eslint-disable-next-line no-unused-expressions
116116 expect ( response ) . to . be . an ( 'object' )
117+ // eslint-disable-next-line no-unused-expressions
117118 expect ( response . items ) . to . be . an ( 'array' )
119+ // eslint-disable-next-line no-unused-expressions
118120 expect ( response . items . length ) . to . be . at . least ( 1 )
119-
121+
120122 // Find our alias in the results
121123 const item = response . items . find ( a => a . alias === testAliasUid )
124+ // eslint-disable-next-line no-unused-expressions
122125 expect ( item ) . to . exist
123126 expect ( item . urlPath ) . to . equal ( `/stacks/branches/${ testBranchUid } ` )
124127 // Check SDK methods exist on response items
@@ -169,7 +172,6 @@ describe('Branch Alias API Tests', () => {
169172 // ==========================================================================
170173
171174 describe ( 'Branch Alias Validation' , ( ) => {
172-
173175 it ( 'should validate alias response structure' , async function ( ) {
174176 this . timeout ( 15000 )
175177
@@ -216,7 +218,6 @@ describe('Branch Alias API Tests', () => {
216218 // ==========================================================================
217219
218220 describe ( 'Error Handling' , ( ) => {
219-
220221 it ( 'should fail to fetch non-existent alias' , async function ( ) {
221222 this . timeout ( 15000 )
222223
@@ -256,7 +257,6 @@ describe('Branch Alias API Tests', () => {
256257 // ==========================================================================
257258
258259 describe ( 'Branch Alias Delete' , ( ) => {
259-
260260 it ( 'should delete branch alias' , async function ( ) {
261261 this . timeout ( 45000 )
262262
@@ -267,7 +267,7 @@ describe('Branch Alias API Tests', () => {
267267 try {
268268 // Create temp alias pointing to main
269269 await stack . branchAlias ( tempAliasUid ) . createOrUpdate ( 'main' )
270-
270+
271271 await wait ( 2000 )
272272
273273 const response = await stack . branchAlias ( tempAliasUid ) . delete ( )
0 commit comments