Compare commits
3 commits
7c1720cd4e
...
fda332654e
Author | SHA1 | Date | |
---|---|---|---|
fda332654e | |||
efd3568e85 | |||
cd91ba8bce |
4 changed files with 56 additions and 1 deletions
|
@ -37,6 +37,10 @@
|
|||
"-"
|
||||
time)))
|
||||
|
||||
;; TODO: the docstrings are not really accurate, they should more reflect that
|
||||
;; they are just formating GUID not really generating it according to anything
|
||||
;; from the outside as it may seem
|
||||
|
||||
(defn new-guid-paranoid
|
||||
"Generate unique GUID on EVERY request to the feed.
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
(deftest a-test
|
||||
(testing "FIXME, I fail."
|
||||
(is (= 0 1))))
|
||||
(is (= 1 1))))
|
||||
|
|
34
test/rss_thread_watch/feed_generator_test.clj
Normal file
34
test/rss_thread_watch/feed_generator_test.clj
Normal file
|
@ -0,0 +1,34 @@
|
|||
(ns rss-thread-watch.feed-generator-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[rss-thread-watch.feed-generator :refer :all]))
|
||||
|
||||
(def thread-list [{:title "Some thread title"
|
||||
:chod 94.0
|
||||
:no 696942042
|
||||
:last-modified 20}
|
||||
{:title "Some nearly dead THREAD"
|
||||
:chod 69.0
|
||||
:no 3480000
|
||||
:last-modified 10}])
|
||||
(def sin-thrd (first thread-list))
|
||||
|
||||
|
||||
(deftest guid-generation
|
||||
(let [millis (System/currentTimeMillis)]
|
||||
(testing "New GUID on every data refresh"
|
||||
(is (let [millis (System/currentTimeMillis)
|
||||
tno (:no sin-thrd)]
|
||||
(= (:guid (new-guid-always sin-thrd millis)) (str tno "-" millis)))))
|
||||
(testing "Paranoid GUID - new on every user request"
|
||||
(is (not= (new-guid-paranoid sin-thrd) (do (Thread/sleep 2)
|
||||
(new-guid-paranoid sin-thrd)))))
|
||||
(testing "GUID update only when thread changes position"
|
||||
(is (= (update-only-guid sin-thrd)
|
||||
(assoc sin-thrd :guid "696942042-20-94.00"))))))
|
||||
|
||||
(deftest filtering
|
||||
(testing "Filter map making")
|
||||
)
|
||||
|
||||
|
||||
|
17
test/rss_thread_watch/filter_test.clj
Normal file
17
test/rss_thread_watch/filter_test.clj
Normal file
|
@ -0,0 +1,17 @@
|
|||
(ns rss-thread-watch.filter-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[rss-thread-watch.filters :refer :all]))
|
||||
|
||||
(def thread {:title "This is a thread TiTle wItH some extRa text"
|
||||
:no 928398237932
|
||||
:chod 92})
|
||||
|
||||
|
||||
(deftest filters
|
||||
(testing "Case sensitive filter"
|
||||
(is (case-sensitive-filter thread ["TiTle"]))
|
||||
(is (= (case-sensitive-filter thread ["TITLE"]) nil)))
|
||||
(testing "Case insensitive filter"
|
||||
(is (case-insensitive-filter thread ["TiTle"]))
|
||||
(is (case-insensitive-filter thread ["with"]))))
|
||||
|
Loading…
Reference in a new issue