@@ -80,30 +80,33 @@ describe('DBClusterNode', function () {
8080 trackChangesSpy . restore ( )
8181 } )
8282
83- it ( 'does not start tracking changes when status does not require polling' , function ( ) {
84- const clusterStatus = { ...cluster , Status : 'available' }
83+ function assertNodeDoesNotPoll ( clusterStatus : any , message : string ) {
8584 const trackChangesSpy = sinon . spy ( DBClusterNode . prototype , 'trackChanges' )
8685 const node = new DBClusterNode ( parentNode , clusterStatus , mockClient )
8786 const requiresPolling = node . isStatusRequiringPolling ( )
8887
89- assert . strictEqual ( requiresPolling , false , 'isStatusRequiringPolling should return false for available status' )
90- assert . ok ( trackChangesSpy . notCalled , 'trackChanges should not be called when polling is not required' )
91- assert . strictEqual ( node . isPolling , false , 'Node should not be in polling state' )
88+ assert . strictEqual (
89+ requiresPolling ,
90+ false ,
91+ `${ message } : isStatusRequiringPolling should return false for available status`
92+ )
93+ assert . ok (
94+ trackChangesSpy . notCalled ,
95+ `${ message } : trackChanges should not be called when polling is not required`
96+ )
97+ assert . strictEqual ( node . isPolling , false , `${ message } : Node should not be in polling state` )
9298
9399 trackChangesSpy . restore ( )
100+ }
101+
102+ it ( 'does not start tracking changes when status does not require polling' , function ( ) {
103+ const clusterStatus = { ...cluster , Status : 'available' }
104+ assertNodeDoesNotPoll ( clusterStatus , 'does not start tracking changes' )
94105 } )
95106
96107 it ( 'does not poll when status is available' , function ( ) {
97108 const clusterStatus = { ...cluster , Status : 'available' }
98- const trackChangesSpy = sinon . spy ( DBClusterNode . prototype , 'trackChanges' )
99- const node = new DBClusterNode ( parentNode , clusterStatus , mockClient )
100- const requiresPolling = node . isStatusRequiringPolling ( )
101-
102- assert . strictEqual ( requiresPolling , false , 'isStatusRequiringPolling should return false for available status' )
103- assert . ok ( trackChangesSpy . notCalled , 'trackChanges should not be called when polling is not required' )
104- assert . strictEqual ( node . isPolling , false , 'Node should not be in polling state' )
105-
106- trackChangesSpy . restore ( )
109+ assertNodeDoesNotPoll ( clusterStatus , 'does not poll' )
107110 } )
108111
109112 it ( 'has isPolling set to false and getStatus returns available when status is available' , async function ( ) {
0 commit comments