<commit_before>(ns nhl-score-api.fetchers.mlbam.latest-games-test
  (:require [clojure.test :refer :all]
            [nhl-score-api.fetchers.mlbam.latest-games :refer :all]
            [nhl-score-api.fetchers.mlbam.resources :as resources]))

(deftest latest-games-filtering

  (testing "Only latest started games are selected"
    (let [latest-games (:games
                         (filter-latest-started-games resources/games-in-live-preview-and-final-states))]
      (is (= 3
             (count latest-games)) "Latest started games count")
      (is (= ["Final" "Live"]
             (distinct (map #(:abstract-game-state (:status %)) latest-games))) "Distinct game states")))

  (testing "Finished games are returned before on-going ones"
    (let [latest-games (:games
                         (filter-latest-started-games resources/games-in-live-preview-and-final-states))]
      (is (= ["Final" "Live" "Live"]
             (map #(:abstract-game-state (:status %)) latest-games))) "Game states"))

  (testing "No started games is handled gracefully"
    (let [latest-games (:games
                         (filter-latest-started-games resources/games-in-preview-state))]
      (is (= 0
             (count latest-games)) "Latest started games count")))

  (testing "Date of latest started games is included"
    (let [date (:date
                 (filter-latest-started-games resources/games-in-live-preview-and-final-states))]
      (is (= "2016-02-28"
             (:raw date)))
      (is (= "Sun Feb 28"
             (:pretty date))))))<commit_msg>Fix parentheses in latest games test assertion<commit_after>(ns nhl-score-api.fetchers.mlbam.latest-games-test
  (:require [clojure.test :refer :all]
            [nhl-score-api.fetchers.mlbam.latest-games :refer :all]
            [nhl-score-api.fetchers.mlbam.resources :as resources]))

(deftest latest-games-filtering

  (testing "Only latest started games are selected"
    (let [latest-games (:games
                         (filter-latest-started-games resources/games-in-live-preview-and-final-states))]
      (is (= 3
             (count latest-games)) "Latest started games count")
      (is (= ["Final" "Live"]
             (distinct (map #(:abstract-game-state (:status %)) latest-games))) "Distinct game states")))

  (testing "Finished games are returned before on-going ones"
    (let [latest-games (:games
                         (filter-latest-started-games resources/games-in-live-preview-and-final-states))]
      (is (= ["Final" "Live" "Live"]
             (map #(:abstract-game-state (:status %)) latest-games)) "Game states")))

  (testing "No started games is handled gracefully"
    (let [latest-games (:games
                         (filter-latest-started-games resources/games-in-preview-state))]
      (is (= 0
             (count latest-games)) "Latest started games count")))

  (testing "Date of latest started games is included"
    (let [date (:date
                 (filter-latest-started-games resources/games-in-live-preview-and-final-states))]
      (is (= "2016-02-28"
             (:raw date)))
      (is (= "Sun Feb 28"
             (:pretty date))))))
{'fraction_non_alphanumeric': 0.1479834868212131, 'fraction_numerical': 0.007621467132422992, 'mean_word_length': 2.4653465346534653, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2365493', 'n_tokens_mistral': 1027, 'n_tokens_neox': 913, 'n_words': 227}