<commit_before>//
//  GetContentType.swift
//  KenticoCloud
//
//  Created by <NAME> on 13/10/2017.
//  Copyright © 2017 CocoaPods. All rights reserved.
//

import Quick
import Nimble
import KenticoCloud

class GetContentTypeSpec: QuickSpec {
    override func spec() {
        describe("Get content type request") {
            
            let client = DeliveryClient.init(projectId: TestConstants.projectId)
            
            //MARK: Get some content types
            
            context("getting content type using content type name", {
                
                it("returns content type with correct name codename and elements") {
                    
                    waitUntil(timeout: 5) { done in
                        client.getContentType(name: "coffee", completionHandler: { (isSuccess, contentType, error) in
                            if !isSuccess {
                                fail("Response is not successful. Error: \(String(describing: error))")
                            }
                            
                            if let type = contentType {
                                let expectedName = "Coffee"
                                let expecedCodename = "coffee"
                                let expectedElementName = "Farm"
                                let expectedElementType = "text"
                                let expectedElementsCount = 13
                                expect(type.name) == expectedName
                                expect(type.codename) == expecedCodename
                                expect(type.elements?.count) == expectedElementsCount
                                expect(type.elements?["farm"]?.type) == expectedElementType
                                expect(type.elements?["farm"]?.name) == expectedElementName
                                done()
                            }
                        })
                    }
                }
            })
        }
    }<commit_msg>Test fix<commit_after>//
//  GetContentType.swift
//  KenticoCloud
//
//  Created by <NAME> on 13/10/2017.
//  Copyright © 2017 CocoaPods. All rights reserved.
//

import Quick
import Nimble
import KenticoCloud

class GetContentTypeSpec: QuickSpec {
    override func spec() {
        describe("Get content type request") {
            
            let client = DeliveryClient.init(projectId: TestConstants.projectId)
            
            //MARK: Get some content types
            
            context("getting content type using content type name", {
                
                it("returns content type with correct name codename and elements") {
                    
                    waitUntil(timeout: 5) { done in
                        client.getContentType(name: "coffee", completionHandler: { (isSuccess, contentType, error) in
                            if !isSuccess {
                                fail("Response is not successful. Error: \(String(describing: error))")
                            }
                            
                            if let type = contentType {
                                let expectedName = "Coffee"
                                let expecedCodename = "coffee"
                                let expectedElementName = "Farm"
                                let expectedElementType = "text"
                                let expectedElementsCount = 12
                                expect(type.name) == expectedName
                                expect(type.codename) == expecedCodename
                                expect(type.elements?.count) == expectedElementsCount
                                expect(type.elements?["farm"]?.type) == expectedElementType
                                expect(type.elements?["farm"]?.name) == expectedElementName
                                done()
                            }
                        })
                    }
                }
            })
        }
    }
{'fraction_non_alphanumeric': 0.07625218041365561, 'fraction_numerical': 0.0074757039621231, 'mean_word_length': 1.0563524590163935, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5563166', 'n_tokens_mistral': 924, 'n_tokens_neox': 842, 'n_words': 213}