<commit_before>//
//  NewsProviderSpec.swift
//  Tests
//
//  Created by <NAME> on 22/06/18.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import Nimble
import Quick

@testable import NewsAPISwift

class NewsAPITargetSpec: QuickSpec {
    override func spec() {
        describe("NewsAPI") {
            it("baseUrl") {
                expect(NewsAPITarget.sources(category: .all, language: .all, country: .all).baseUrl) == "https://newsapi.org"
            }
        }
        
        describe("Sources Endpoint") {
            it("Has Path") {
                expect(NewsAPITarget.sources(category: .all, language: .all, country: .all).path) == "/v2/sources"
            }
            
            describe("Parameters") {
                context("When All Parameters Are All") {
                    it("Returns All Parameters") {
                        expect(NewsAPITarget.sources(category: .all, language: .all, country: .all).parameters)
                            == [:]
                    }
                }
                
                context("When Category Is General") {
                    it("Returns General Category") {
                        expect(NewsAPITarget.sources(category: .general, language: .all, country: .all).parameters)
                            == ["category": "general"]
                    }
                }
                
                context("When Language Is English") {
                    it("Returns English Language") {
                        expect(NewsAPITarget.sources(category: .all, language: .en, country: .all).parameters)
                            == ["language": "en"]
                    }
                }
                
                context("When Language Is English") {
                    it("Returns English Language") {
                        expect(NewsAPITarget.sources(category: .all, language: .en, country: .all).parameters)
                            == ["language": "en"]
                    }
                }
                
                context("When Country is US") {
                    it("Returns US Country") {
                        expect(NewsAPITarget.sources(category: .all, language: .all, country: .us).parameters)
                            == ["country": "us"]
                    }
                }
            }<commit_msg>test: Adds other test cases for NewsAPITarget<commit_after>//
//  NewsProviderSpec.swift
//  Tests
//
//  Created by <NAME> on 22/06/18.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import Nimble
import Quick

@testable import NewsAPISwift

class NewsAPITargetSpec: QuickSpec {
    override func spec() {
        describe("NewsAPI") {
            it("baseUrl") {
                expect(NewsAPITarget.sources(category: .all, language: .all, country: .all).baseUrl) == "https://newsapi.org"
            }
        }
        
        describe("Sources Endpoint") {
            it("Has Path") {
                expect(NewsAPITarget.sources(category: .all, language: .all, country: .all).path) == "/v2/sources"
            }
            
            describe("Parameters") {
                context("When All Parameters Are All") {
                    it("Returns All Parameters") {
                        expect(NewsAPITarget.sources(category: .all, language: .all, country: .all).parameters)
                            == [:]
                    }
                }
                
                context("When Category Is General") {
                    it("Returns General Category") {
                        expect(NewsAPITarget.sources(category: .general, language: .all, country: .all).parameters)
                            == ["category": "general"]
                    }
                }
                
                context("When Language Is English") {
                    it("Returns English Language") {
                        expect(NewsAPITarget.sources(category: .all, language: .en, country: .all).parameters)
                            == ["language": "en"]
                    }
                }
                
                context("When Language Is English") {
                    it("Returns English Language") {
                        expect(NewsAPITarget.sources(category: .all, language: .en, country: .all).parameters)
                            == ["language": "en"]
                    }
                }
                
                context("When Country is US") {
                    it("Returns US Country") {
                        expect(NewsAPITarget.sources(category: .all, language: .all, country: .us).parameters)
                            == ["country": "us"]
                    }
                }
                
                context("When Has Values For All Parameters") {
                    it("Returns All Parameters") {
                        let parameters = NewsAPITarget.sources(category: .general, language: .en, country: .us).parameters
                        expect(parameters.count) == 3
                        expect(parameters["category"]) == "general"
                        expect(parameters["language"]) == "en"
                        expect(parameters["country"]) == "us"
                    }
                }
            }
{'fraction_non_alphanumeric': 0.11618650492797573, 'fraction_numerical': 0.004359363153904473, 'mean_word_length': 1.1914451827242525, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '4201023', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1193, 'n_words': 277}