1
1
(ns clojurians-log.slack-mgs-test
2
2
(:require [clojurians-log.db.queries :as queries]
3
- [clojurians-log.time-util :as time-util ]
3
+ [time-literals.data-readers ]
4
4
[clojure.test :refer :all ]))
5
5
6
6
(deftest filter-channel-day-messages-test
9
9
:message/thread-ts " 1512384953.000000" }]))))
10
10
(testing " thread parents should be retained"
11
11
(is (= #:message{:ts " 1014090027.000404"
12
- :inst ( time-util/ts->inst " 1014090027.000404 " ) }
12
+ :inst # time/instant " 2002-02-19T03:40:27.000404Z " }
13
13
(first(queries/filter-channel-day-messages [{:message/ts " 1014090027.000404" }])))))
14
14
(testing " broadcast messages should be retained"
15
15
(is (=
16
16
#:message{:ts " 1518095027.000404"
17
17
:thread-ts " 1518040988.000079"
18
18
:thread-broadcast? true
19
19
:top-level? true
20
- :inst ( time-util/ts->inst " 1518095027.000404 " ) }
20
+ :inst # time/instant " 2018-02-08T13:03:47.000404Z " }
21
21
(first (queries/filter-channel-day-messages [{:message/ts " 1518095027.000404"
22
22
:message/thread-ts " 1518040988.000079"
23
23
:message/thread-broadcast? true }
24
24
{:message/ts " 1014090027.000404"
25
25
:message/thread-ts " 1010040908.000079" }])))))
26
26
(testing " should be sorted by timestamp"
27
- (is (=(type
28
- {#:messages{:ts " 1512389691.000900"
29
- :inst ( time-util/ts->inst " 1512389691.000900 " ) }
30
- #:messages{:ts " 1512394953.120000"
31
- :inst ( time-util/ts->inst " 1512394953.120000 " ) }
32
- #:messages{:ts " 1518384553.060000"
33
- :inst ( time-util/ts->inst " 1518384553.060000 " ) }
34
- #:messages{:ts " 1518989553.060000"
35
- :inst ( time-util/ts->inst " 1518989553.060000 " )}})
36
- (type ( queries/filter-channel-day-messages [{:message/ts " 1518989553.060000" }
37
- {:message/ts " 1512394953.120000" }
38
- {:message/ts " 1512389691.000900" }
39
- {:message/ts " 1518384553.060000" }]) )))))
27
+ (is (=
28
+ {#:messages{:ts " 1512389691.000900"
29
+ :inst # time/instant " 2017-12-04T12:14:51.000900Z " }
30
+ #:messages{:ts " 1512394953.120000"
31
+ :inst # time/instant " 2017-12-04T13:42:33.120Z " }
32
+ #:messages{:ts " 1518384553.060000"
33
+ :inst # time/instant " 2018-02-11T21:29:13.060Z " }
34
+ #:messages{:ts " 1518989553.060000"
35
+ :inst # time/instant " 2018-02-18T21:32:33.060Z " }}
36
+ (queries/filter-channel-day-messages [{:message/ts " 1518989553.060000" }
37
+ {:message/ts " 1512394953.120000" }
38
+ {:message/ts " 1512389691.000900" }
39
+ {:message/ts " 1518384553.060000" }])))))
40
40
(testing " should get the message/inst added to the messages"
41
- (is (= ( type {#:messages {:ts " 1014090027.000404"
42
- :inst ( time-util/ts->inst " 1014090027.000404 " ) }
43
- #:messages {:ts " 1518384553.060000"
44
- :thread-broadcast? true
45
- :top-level true
46
- :inst ( time-util/ts->inst " 1518384553.060000 " )}})
47
- (type ( queries/filter-channel-day-messages [{:message/ts " 1014090027.000404" }
48
- {:message/ts " 1218384553.060000"
49
- :message/thread-broadcast? true }]) ))))
41
+ (is (= {#:messages {:ts " 1014090027.000404"
42
+ :inst # time/instant " 2002-02-19T03:40:27.000404Z " }
43
+ #:messages {:ts " 1518384553.060000"
44
+ :thread-broadcast? true
45
+ :top-level true
46
+ :inst # time/instant " 2018-02-11T21:29:13.060Z " }}
47
+ (queries/filter-channel-day-messages [{:message/ts " 1014090027.000404" }
48
+ {:message/ts " 1218384553.060000"
49
+ :message/thread-broadcast? true }]))))
50
50
(testing " top-level messages should get marked as :message/top-level?"
51
- (is (=
52
- #:message{:ts " 1014090027.000404"
53
- :thread-broadcast? true
54
- :top-level? true
55
- :inst (time-util/ts->inst " 1014090027.000404" )}
56
- (first (queries/filter-channel-day-messages [{:message/ts " 1014090027.000404"
57
- :message/thread-broadcast? true }])))))
51
+ (is (= {#:message{:ts " 1014090027.000404"
52
+ :thread-broadcast? true
53
+ :top-level? true
54
+ :inst #time/instant " 2002-02-19T03:40:27.000404Z" }
55
+ #:message{:ts " 1518008583.000370"
56
+ :thread-ts 1517995093.000487
57
+ :thread-broadcast? true
58
+ :top-level? true
59
+ :inst #time/instant " 2018-02-07T13:03:03.000370Z" }}
60
+ (queries/filter-channel-day-messages [{:message/ts " 1014090027.000404"
61
+ :message/thread-broadcast? true }
62
+ {:message/ts " 1518008583.000370"
63
+ :message/thread-ts " 1517995093.000487"
64
+ :message/thread-broadcast? true }]))))
0 commit comments