                                                                         animationDuration: 0.0)
 
         XCTAssertEqual(viewModel.animatedAlphaLayerFrameUpdate.value, expectedAnimatedAlphaLayerFrameUpdate)
+    }
+
+    func testSettingBoundsWithSameValueShouldSetAnimatedAlphaLayerFrameUpdateJustOnce() {
+        // Given
+        let progress: Float = 0.25
+        viewModel.setProgress(progress)
+
+        let bounds = CGRect(x: 2.0, y: 4.0, width: 6.0, height: 8.0)
+
+        var observerCounter = 0
+        var disposal = Disposal()
+        viewModel.animatedAlphaLayerFrameUpdate.observe { _, oldAnimatedAlphaLayerFrameUpdate in
+            guard oldAnimatedAlphaLayerFrameUpdate != nil else {
+                // Skip initial call to observer.
+                return
+            }
+
+            observerCounter += 1
+        }.add(to: &disposal)
+
+        // When
+        for _ in 1 ... 3 {
+            viewModel.bounds = bounds
+        }
+
+        // Then
+        XCTAssertEqual(observerCounter, 1)
     }
 
     // MARK: - Test method `setProgress()`


    func testSettingBoundsShouldSetAnimatedAlphaLayerFrameUpdateWithCorrectFrameButWithoutAnimation() {
        // Given
        let bounds = CGRect(x: 2.0, y: 4.0, width: 6.0, height: 8.0)

        let progress: Float = 0.25
        viewModel.setProgress(progress)

        // When
        viewModel.bounds = bounds

//

import XCTest
import Observable

@testable import GradientProgressBar

class GradientProgressBarViewModelTestCase: XCTestCase {
