|
@@ -1,59 +1,61 @@
|
1
|
|
-(stefil:define-test-package :twitter-summary-card-tests
|
2
|
|
- (:use :cl :coleslaw
|
3
|
|
- :cl-ppcre))
|
|
1
|
+(defpackage :summary-card-tests
|
|
2
|
+ (:use :cl :coleslaw :stefil))
|
4
|
3
|
|
5
|
|
-(in-package :twitter-summary-card-tests)
|
6
|
|
-;;;;
|
7
|
|
-;; To run tests first eval the plugin code inside this package and then execute
|
8
|
|
-;; (twitter-summary-card-test:run-package-tests)
|
9
|
|
-;;;
|
|
4
|
+(in-package :summary-card-tests)
|
10
|
5
|
|
|
6
|
+(defsuite summary-cards)
|
|
7
|
+(in-suite summary-cards)
|
|
8
|
+
|
|
9
|
+;; TODO: Create a fixture to either load a mocked config or load set of plugins.
|
|
10
|
+;; Then wrap these tests to use that fixture. Then add these to defsystem, setup
|
|
11
|
+;; general test run with other packages.
|
|
12
|
+
|
|
13
|
+(coleslaw::enable-plugin :twitter-summary-card)
|
11
|
14
|
|
12
|
15
|
(defvar *short-post*
|
13
|
|
- (make-instance 'post :title "hai" :text "very greetings" :format "html"))
|
|
16
|
+ (make-instance 'post :title "hai" :text "very greetings" :format "html"))
|
14
|
17
|
|
15
|
|
-(defvar *long-post*
|
16
|
|
- (make-instance 'post :title "What a Wonderful World"
|
17
|
|
- :text "I see trees of green, red roses too. I see them
|
|
18
|
+(defvar *long-post*
|
|
19
|
+ (make-instance 'post :title "What a Wonderful World"
|
|
20
|
+ :text "I see trees of green, red roses too. I see them
|
18
|
21
|
bloom, for me and you. And I think to myself, what a wonderful world.
|
19
|
22
|
|
20
|
|
-I see skies of blue,
|
21
|
|
-And clouds of white.
|
22
|
|
-The bright blessed day,
|
23
|
|
-The dark sacred night.
|
24
|
|
-And I think to myself,
|
25
|
|
-What a wonderful world.
|
26
|
|
-
|
27
|
|
-The colors of the rainbow,
|
28
|
|
-So pretty in the sky.
|
29
|
|
-Are also on the faces,
|
30
|
|
-Of people going by,
|
31
|
|
-I see friends shaking hands.
|
32
|
|
-Saying, \"How do you do?\"
|
33
|
|
-They're really saying,
|
34
|
|
-\"I love you\".
|
35
|
|
-
|
36
|
|
-I hear babies cry,
|
37
|
|
-I watch them grow,
|
38
|
|
-They'll learn much more,
|
39
|
|
-Than I'll ever know.
|
40
|
|
-And I think to myself,
|
41
|
|
-What a wonderful world.
|
42
|
|
-
|
43
|
|
-Yes, I think to myself,
|
|
23
|
+I see skies of blue,
|
|
24
|
+And clouds of white.
|
|
25
|
+The bright blessed day,
|
|
26
|
+The dark sacred night.
|
|
27
|
+And I think to myself,
|
|
28
|
+What a wonderful world.
|
|
29
|
+
|
|
30
|
+The colors of the rainbow,
|
|
31
|
+So pretty in the sky.
|
|
32
|
+Are also on the faces,
|
|
33
|
+Of people going by,
|
|
34
|
+I see friends shaking hands.
|
|
35
|
+Saying, \"How do you do?\"
|
|
36
|
+They're really saying,
|
|
37
|
+\"I love you\".
|
|
38
|
+
|
|
39
|
+I hear babies cry,
|
|
40
|
+I watch them grow,
|
|
41
|
+They'll learn much more,
|
|
42
|
+Than I'll ever know.
|
|
43
|
+And I think to myself,
|
|
44
|
+What a wonderful world.
|
|
45
|
+
|
|
46
|
+Yes, I think to myself,
|
44
|
47
|
What a wonderful world. " :format "html"))
|
45
|
48
|
|
46
|
49
|
(deftest summary-card-sans-twitter-handle ()
|
47
|
50
|
(let ((summary-card (summary-card *short-post* nil)))
|
48
|
|
- (is (null (scan "twitter:author" summary-card)))))
|
|
51
|
+ (is (null (cl-ppcre:scan "twitter:author" summary-card)))))
|
49
|
52
|
|
50
|
53
|
(deftest summary-card-with-twitter-handle ()
|
51
|
54
|
(let ((summary-card (summary-card *short-post* "@PuercoPop")))
|
52
|
|
- (is (scan "twitter:author" summary-card))))
|
|
55
|
+ (is (cl-ppcre:scan "twitter:author" summary-card))))
|
53
|
56
|
|
54
|
57
|
(deftest summary-card-trims-long-post ()
|
55
|
58
|
(let ((summary-card (summary-card *long-post* nil)))
|
|
59
|
+ (multiple-value-bind ())
|
56
|
60
|
;; (scan "twitter:description\" content=\"(.*)\"" summary-card)
|
57
|
61
|
summary-card))
|
58
|
|
-
|
59
|
|
-
|