Back

sometimes (clj)

(source)

macro

(sometimes probability & body)
Handy for sampled logging, etc.

Examples

ricardojmendez/tropology
(ns tropology.test.parsing-nodes
  (:require [clojure.test :refer :all]
            [taoensso.timbre.profiling :as prof]
            [tropology.test.db-nodes :as tdb]
            [tropology.test.parsing :as tp]
            [korma.core :refer [select where]]
            [tropology.parsing :refer :all]
            [tropology.db :as db]
            [tropology.base :as b]
            [clojure.string :as s]
            [tropology.s3 :as s3]))

(deftest test-redirect-ignores-query
  ; We now pass a provenance that has a query. TVTropes sometimes does this
  ; to indicate that a page is being redirected to from another one, but
  ; all it actually cares about is the root path.
  ;
  ; Queries should be ignored for redirect purposes.
  (tdb/wipe-test-db)
  (let [path       (str tp/test-file-path "TakeMeInstead-pruned.html")
        _          (record-page! path "http://tvtropes.org/pmwiki/pmwiki.php/main/takemeinstead?a=1")
        main-node  (db/query-by-code "main/takemeinstead")
        links-main (db/query-from "Main/TakeMeInstead" :LINKSTO)
        ]
    (are [property value] (= value (main-node property))
                          :has-error false
                          :category "main"
                          :code "main/takemeinstead"
                          :display "Main/TakeMeInstead"
                          :is-redirect false
                          :url "http://tvtropes.org/pmwiki/pmwiki.php/Main/TakeMeInstead")
    (is (= 4 (count links-main)))
    ))