         XCTAssertEqual(animationGroup.isRemovedOnCompletion, false)
         XCTAssertEqual(animationGroup.repeatCount, Float.infinity)
         
+    }
+    
+    func testStrokeEndAnimations() {
+    
+        sut.layoutSubviews()
+        sut.startAnimating()
+        
+        guard let layer = sut.layer.sublayers?.first as? CAShapeLayer,
+            let animationGroup = layer.animation(forKey: "loading") as? CAAnimationGroup else {
+                XCTAssert(false, "It should have an animationGroup")
+                return
+        }
+        
         guard let animations = animationGroup.animations,
-            let strokeEndAnimation = animations[0] as? CABasicAnimation,
-            let strokeStartAnimation = animations[1] as? CABasicAnimation,
-            let rotationAnimation = animations[2] as? CABasicAnimation,
-            let colorsAnimation = animations[3] as? CAKeyframeAnimation else {
+            let strokeEndAnimation = animations[0] as? CABasicAnimation else {
             XCTAssert(false, "It should have animations")
             return
         }

        XCTAssertEqual(layer.frame, sut.bounds)
    }
    
    func testAnimating() {
        
        sut.layoutSubviews()
        sut.startAnimating()

        XCTAssertEqual(strokeEndAnimation.toValue as? Int, 1)
        XCTAssertEqual(strokeEndAnimation.timingFunction, CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut))
        
    }
    
    func testStrokeStartAnimation() {
        
        sut.layoutSubviews()
        sut.startAnimating()
        
        guard let layer = sut.layer.sublayers?.first as? CAShapeLayer,
            let animationGroup = layer.animation(forKey: "loading") as? CAAnimationGroup else {
                XCTAssert(false, "It should have an animationGroup")
                return
        }
        
        guard let animations = animationGroup.animations,
            let strokeStartAnimation = animations[1] as? CABasicAnimation else {
                XCTAssert(false, "It should have animations")
                return
        }
        
        XCTAssertEqual(strokeStartAnimation.keyPath, "strokeStart")
        XCTAssertEqual(strokeStartAnimation.beginTime, CFTimeInterval(duration/2.0))
