<commit_before>//
//  ArtistTests.swift
//  CiderTests
//
//  Created by <NAME> on 8/2/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import XCTest
@testable import Cider

class ArtistTests: XCTestCase {
    func testArtistFromSearch() throws {
        let search = try fixture(ResponseRoot<SearchResults>.self, name: "search")

        let artist = search.results!.artists!.data![0]

        XCTAssertEqual(artist.id, "117118")
        XCTAssertEqual(artist.type, .artists)
        XCTAssertEqual(artist.href, "/v1/catalog/us/artists/117118")
        XCTAssertNil(artist.relationships)

        let attributes = artist.attributes!
        XCTAssertEqual(attributes.editorialNotes?.standard, "The Godfather of Soul, The Hardest Working Man in Show Business, Soul Brother Number One . . . Mountain-of-a-man nicknames, no doubt, but not one of them ever did <NAME> the justice he deserved. JB’s influence is so large it’s plain impossible to imagine what music today would sound like without him. James didn’t just master soul and funk; he invented them. From the on-bended-knee plea called “Try Me” straight to ground zero of the hip-hop revolution, where his screams, grunts, and funky drummer backboned every cut worth mentioning, Brown was soul power itself, an inspiration to an entire nation. Now that Mr. Dynamite has taken his last sweat-drenched shuffle offstage, we’re all left like an awe-struck Apollo audience — still screaming for just one more encore while trying to take in the force of nature we were blessed to witness. <NAME>’s face should be on money. His likeness carved on a mountain. And, most importantly, his music played forever.")
        XCTAssertEqual(attributes.name, "<NAME>")
        XCTAssertEqual(attributes.genreNames, ["R&B/Soul"])
        XCTAssertEqual(attributes.url, URL(string: "https://itunes.apple.com/us/artist/james-brown/id117118")!)
    }

    func testArtistFromFetch() throws {
        let fetch = try fixture(ResponseRoot<Artist>.self, name: "artist")

        let artist = fetch.data?.first

        XCTAssertEqual(artist?.id, "32940")
        XCTAssertEqual(artist?.type, .artists)
        XCTAssertEqual(artist?.href, "/v1/catalog/us/artists/32940")

        let attributes = artist?.attributes

        XCTAssertEqual(attributes?.url, URL(string: "https://itunes.apple.com/us/artist/michael-jackson/id32940"))
        XCTAssertEqual(attributes?.name, "<NAME>")
        XCTAssertEqual(attributes!.genreNames, ["Pop"])
    }
}

#if os(Linux)
    extension ArtistTests {
        static var allTests: [(String, (ArtistTests) -> () throws -> Void)] {
            return [<commit_msg>Add not nil relationship assertion to artist test.<commit_after>//
//  ArtistTests.swift
//  CiderTests
//
//  Created by <NAME> on 8/2/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import XCTest
@testable import Cider

class ArtistTests: XCTestCase {
    func testArtistFromSearch() throws {
        let search = try fixture(ResponseRoot<SearchResults>.self, name: "search")

        let artist = search.results!.artists!.data![0]

        XCTAssertEqual(artist.id, "117118")
        XCTAssertEqual(artist.type, .artists)
        XCTAssertEqual(artist.href, "/v1/catalog/us/artists/117118")
        XCTAssertNil(artist.relationships)

        let attributes = artist.attributes!
        XCTAssertEqual(attributes.editorialNotes?.standard, "The Godfather of Soul, The Hardest Working Man in Show Business, Soul Brother Number One . . . Mountain-of-a-man nicknames, no doubt, but not one of them ever did <NAME> the justice he deserved. JB’s influence is so large it’s plain impossible to imagine what music today would sound like without him. James didn’t just master soul and funk; he invented them. From the on-bended-knee plea called “Try Me” straight to ground zero of the hip-hop revolution, where his screams, grunts, and funky drummer backboned every cut worth mentioning, Brown was soul power itself, an inspiration to an entire nation. Now that Mr. Dynamite has taken his last sweat-drenched shuffle offstage, we’re all left like an awe-struck Apollo audience — still screaming for just one more encore while trying to take in the force of nature we were blessed to witness. <NAME>’s face should be on money. His likeness carved on a mountain. And, most importantly, his music played forever.")
        XCTAssertEqual(attributes.name, "<NAME>")
        XCTAssertEqual(attributes.genreNames, ["R&B/Soul"])
        XCTAssertEqual(attributes.url, URL(string: "https://itunes.apple.com/us/artist/james-brown/id117118")!)
    }

    func testArtistFromFetch() throws {
        let fetch = try fixture(ResponseRoot<Artist>.self, name: "artist")

        let artist = fetch.data?.first

        XCTAssertEqual(artist?.id, "32940")
        XCTAssertEqual(artist?.type, .artists)
        XCTAssertEqual(artist?.href, "/v1/catalog/us/artists/32940")

        let attributes = artist?.attributes

        XCTAssertEqual(attributes?.url, URL(string: "https://itunes.apple.com/us/artist/michael-jackson/id32940"))
        XCTAssertEqual(attributes?.name, "<NAME>")
        XCTAssertEqual(attributes!.genreNames, ["Pop"])

        XCTAssertNotNil(artist?.relationships)
    }
}

#if os(Linux)
    extension ArtistTests {
        static var allTests: [(String, (ArtistTests) -> () throws -> Void)] {
            return [
{'fraction_non_alphanumeric': 0.10452766908887647, 'fraction_numerical': 0.016396497111980622, 'mean_word_length': 3.488294314381271, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '345053', 'n_tokens_mistral': 1647, 'n_tokens_neox': 1532, 'n_words': 508}