 @testable import Rocket_Chat
 
 private func assert<T: Equatable>(_ attributedString: NSAttributedString,
-                                  has attribute: (String, T),
+                                  has attribute: (NSAttributedStringKey, T),
                                   in range: NSRange, _ message: String) {
     attributedString.enumerateAttributes(in: range, options: [], using: { attributes, crange, _ in
-        XCTAssert(range.toRange() == crange.toRange() && attributes[attribute.0] as? T == attribute.1, message)
+        XCTAssert(Range(range) == Range(crange) && attributes[attribute.0] as? T == attribute.1, message)
     })
 }
 

        let color = UIColor.red
        attributedString.setFontColor(color, range: wordRange)

        assert(attributedString, has: (NSForegroundColorAttributeName, color), in: wordRange, "setFontColor will work")
    }

    func testSetBackgroundColor() {

        let color = UIColor.red
        attributedString.setBackgroundColor(color, range: wordRange)

        assert(attributedString, has: (NSAttributedStringKey.backgroundColor, color), in: wordRange, "setBackgroundColor will work")
    }
}
