WIP add weekly tests

This commit is contained in:
Nathan Dwarshuis 2022-08-14 14:46:05 -04:00
parent 95e03b8eb7
commit 75a7bacb68
2 changed files with 49 additions and 2 deletions

View File

@ -11,11 +11,15 @@ SCHEDULED: <2022-06-06 Mon>
:PROPERTIES: :PROPERTIES:
:ID: 6b53ee41-b467-4bfb-a580-6218a3c78068 :ID: 6b53ee41-b467-4bfb-a580-6218a3c78068
:END: :END:
***** TODO be social ***** DONE be social
CLOSED: [2022-08-07 Sun 23:28]
:PROPERTIES: :PROPERTIES:
:ID: f02504bd-45f8-4da6-936e-1b15e043f3d4 :ID: f02504bd-45f8-4da6-936e-1b15e043f3d4
:CREATED: [2022-06-07 Tue 22:50] :CREATED: [2022-06-07 Tue 22:50]
:END: :END:
:LOGGING:
- State "DONE" from "TODO" [2022-08-07 Sun 23:28]
:END:
**** TODO Tuesday **** TODO Tuesday
SCHEDULED: <2022-06-07 Tue> SCHEDULED: <2022-06-07 Tue>
:PROPERTIES: :PROPERTIES:
@ -41,11 +45,15 @@ SCHEDULED: <2022-06-10 Fri>
:PROPERTIES: :PROPERTIES:
:ID: 1d926eef-94c9-4b57-8cb0-225a308711e9 :ID: 1d926eef-94c9-4b57-8cb0-225a308711e9
:END: :END:
***** TODO learn to gamble ***** CANC learn to gamble
CLOSED: [2022-08-07 Sun 23:28]
:PROPERTIES: :PROPERTIES:
:ID: ab077745-4041-458f-90ec-02aaecb2729d :ID: ab077745-4041-458f-90ec-02aaecb2729d
:CREATED: [2022-06-07 Tue 22:51] :CREATED: [2022-06-07 Tue 22:51]
:END: :END:
:LOGGING:
- State "CANC" from "TODO" [2022-08-07 Sun 23:28]
:END:
**** TODO Saturday **** TODO Saturday
SCHEDULED: <2022-06-11 Sat> SCHEDULED: <2022-06-11 Sat>
:PROPERTIES: :PROPERTIES:

View File

@ -210,6 +210,34 @@
(cons nil m) (cons nil m)
(cons t (format "Expected '%s' not to be the indicated action" test-expr)))))) (cons t (format "Expected '%s' not to be the indicated action" test-expr))))))
(buttercup-define-matcher :id-to-be-qtp (to-test status deadline date)
(cl-destructuring-bind
((test-expr . test) (_ . s) (_ . d) (_ . D))
(->> (list to-test status deadline date)
(-map #'buttercup--expr-and-value))
(let* ((local-eq-funs (list :deadline #'element-equal-p :date #'eq))
(abs-date (org-x-dag-date-to-absolute D))
(data (list :deadline d :date abs-date))
(f (->> (-partial #'status-diff-msg local-eq-funs test-expr s nil data)
(-partial #'buffer-status-diff-msg test-expr :quarterly)
(-partial #'right-diff-msg test-expr))))
(-if-let (m (funcall f (org-x-dag-id->bs test)))
(cons nil m)
(cons t (format "Expected '%s' not to be the indicated action" test-expr))))))
;; (buttercup-define-matcher :id-to-be-wkp (to-test status subtype date)
;; (cl-destructuring-bind
;; ((test-expr . test) (_ . s) (_ . y) (_ . d))
;; (->> (list to-test status subtype date)
;; (-map #'buttercup--expr-and-value))
;; (let* ((abs-date (org-x-dag-date-to-absolute d))
;; (f (->> (-partial #'status-diff-msg nil test-expr y `(,s) abs-date)
;; (-partial #'buffer-status-diff-msg test-expr :weekly)
;; (-partial #'right-diff-msg test-expr))))
;; (-if-let (m (funcall f (org-x-dag-id->bs test)))
;; (cons nil m)
;; (cons t (format "Expected '%s' not to be the indicated action" test-expr))))))
;; (buttercup-define-matcher :to-have-same-as-plist (a b) ;; (buttercup-define-matcher :to-have-same-as-plist (a b)
;; (cl-destructuring-bind ;; (cl-destructuring-bind
;; ((a-expr . a) (b-expr . b)) ;; ((a-expr . a) (b-expr . b))
@ -390,6 +418,17 @@
:child-scheds `(,s0 ,s1) :child-scheds `(,s0 ,s1)
:leading-sched-dt (plist-get s1 :datetime))))))) :leading-sched-dt (plist-get s1 :datetime)))))))
;; TODO add deadline to this (but in absolute form)
(describe "Quarterly buffer statuses"
(it "Active"
(expect "aa3e549c-b309-40a2-a687-6d9791653a18" :id-to-be-qtp
:active nil '(2022 4 1))))
;; (describe "Weekly buffer statuses"
;; (it "Active (leaf)"
;; (expect "ed1406ad-1231-46de-b026-8067411133dc" :id-to-be-wkp
;; :active :leaf '(2022 6 6))))
(describe "Metadata Tests" (describe "Metadata Tests"
(it "parent tag" (it "parent tag"
(expect (org-x-dag-id->tags "3de25d74-b90e-4c77-9f7f-8190187e7ed0") (expect (org-x-dag-id->tags "3de25d74-b90e-4c77-9f7f-8190187e7ed0")