Something went wrong. Try again.
an open source Navidrome client written in Swift dub.sh/getflo
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102//// ExplicitStatusTests.swift// floTests//
import XCTest
@testable import flo
final class ExplicitStatusTests: XCTestCase {
// MARK: - init(from:) raw value mapping
func testInit_fromNil_returnsUnknown() { XCTAssertEqual(ExplicitStatus(from: nil), .unknown) }
func testInit_fromEmptyString_returnsUnknown() { XCTAssertEqual(ExplicitStatus(from: ""), .unknown) }
func testInit_fromWhitespace_returnsUnknown() { XCTAssertEqual(ExplicitStatus(from: " "), .unknown) }
func testInit_fromExplicit_returnsExplicit() { XCTAssertEqual(ExplicitStatus(from: "explicit"), .explicit) }
func testInit_fromExplicitUppercase_returnsExplicit() { XCTAssertEqual(ExplicitStatus(from: "EXPLICIT"), .explicit) }
func testInit_fromExplicitWithWhitespace_returnsExplicit() { XCTAssertEqual(ExplicitStatus(from: " explicit "), .explicit) }
func testInit_fromE_returnsExplicit() { XCTAssertEqual(ExplicitStatus(from: "e"), .explicit) }
func testInit_fromNumber1_returnsExplicit() { XCTAssertEqual(ExplicitStatus(from: "1"), .explicit) }
func testInit_fromNumber4_returnsExplicit() { XCTAssertEqual(ExplicitStatus(from: "4"), .explicit) }
func testInit_fromClean_returnsClean() { XCTAssertEqual(ExplicitStatus(from: "clean"), .clean) }
func testInit_fromCleanUppercase_returnsClean() { XCTAssertEqual(ExplicitStatus(from: "CLEAN"), .clean) }
func testInit_fromC_returnsClean() { XCTAssertEqual(ExplicitStatus(from: "c"), .clean) }
func testInit_fromNumber2_returnsClean() { XCTAssertEqual(ExplicitStatus(from: "2"), .clean) }
func testInit_fromUnknownString_returnsUnknown() { XCTAssertEqual(ExplicitStatus(from: "garbage"), .unknown) }
// MARK: - isExplicit
func testIsExplicit_explicitCase_returnsTrue() { XCTAssertTrue(ExplicitStatus.explicit.isExplicit) }
func testIsExplicit_cleanCase_returnsFalse() { XCTAssertFalse(ExplicitStatus.clean.isExplicit) }
func testIsExplicit_unknownCase_returnsFalse() { XCTAssertFalse(ExplicitStatus.unknown.isExplicit) }
// MARK: - annotatedTitle
func testAnnotatedTitle_explicit_addsBadge() { let result = ExplicitStatus.explicit.annotatedTitle("Song Name") XCTAssertTrue(result.contains("\u{1F174}")) XCTAssertTrue(result.hasPrefix("Song Name")) }
func testAnnotatedTitle_clean_returnsAsIs() { let result = ExplicitStatus.clean.annotatedTitle("Song Name") XCTAssertEqual(result, "Song Name") }
func testAnnotatedTitle_unknown_returnsAsIs() { let result = ExplicitStatus.unknown.annotatedTitle("Song Name") XCTAssertEqual(result, "Song Name") }}