Take a more granular approach to checking descriptions.

This commit is contained in:
John Wiseman 2020-01-07 15:29:27 -08:00
parent 4c2786ce56
commit 4daf50d9ce

View File

@ -128,7 +128,10 @@
wiki-nearby {} wiki-nearby {}
nearby [] nearby []
desc (circlebot/generate-description ac sqb reverse wiki-nearby nearby)] desc (circlebot/generate-description ac sqb reverse wiki-nearby nearby)]
(is (= desc "NBADB0Y, a B52, is circling over Silver Lake, Los Angeles #NBADB0Y")))) (is (re-find #"NBADB0Y" desc))
(is (re-find #"B52" desc))
(is (re-find #"Silver Lake.*Los Angeles" desc))
(is (re-find #"#NBADB0Y" desc))))
(testing "Missing ADSBX registration" (testing "Missing ADSBX registration"
(let [ac {:icao "B00B00"} (let [ac {:icao "B00B00"}
sqb {:registration "NGOODB0Y" sqb {:registration "NGOODB0Y"
@ -137,7 +140,10 @@
wiki-nearby {} wiki-nearby {}
nearby {:name "Disneyland" :distance 2} nearby {:name "Disneyland" :distance 2}
desc (circlebot/generate-description ac sqb reverse wiki-nearby nearby)] desc (circlebot/generate-description ac sqb reverse wiki-nearby nearby)]
(is (= desc "NGOODB0Y, a B52, is circling over Silver Lake, Los Angeles #NGOODB0Y")))) (is (re-find #"NGOODB0Y" desc))
(is (re-find #"B52" desc))
(is (re-find #"Silver Lake.*Los Angeles" desc))
(is (re-find #"#NGOODB0Y" desc))))
(testing "foo" (testing "foo"
(let [ac {:military? false :alt 1300 :speed 72.1 :squawk "1200" (let [ac {:military? false :alt 1300 :speed 72.1 :squawk "1200"
:icao "AAE0C2" :type nil, :callsign "N80NT", :registration nil} :icao "AAE0C2" :type nil, :callsign "N80NT", :registration nil}
@ -146,4 +152,11 @@
wiki-nearby {} wiki-nearby {}
nearby {:name "Disneyland" :distance 2} nearby {:name "Disneyland" :distance 2}
desc (circlebot/generate-description ac sqb reverse wiki-nearby nearby)] desc (circlebot/generate-description ac sqb reverse wiki-nearby nearby)]
(is (= desc "N80NT, a Eurocopter Squirrel AS 350 B2, (callsign N80NT) is circling over Silver Lake, Los Angeles at 1300 feet, speed 83 MPH, squawking 1200, #N80NT"))))) (is (re-find #"N80NT" desc))
(is (re-find #"a Eurocopter Squirrel AS 350 B2" desc))
(is (re-find #"callsign N80NT" desc))
(is (re-find #"Silver Lake.*Los Angeles" desc))
(is (re-find #"1300 feet" desc))
(is (re-find #"speed 83 MPH" desc))
(is (re-find #"squawking 1200" desc))
(is (re-find #"#N80NT" desc)))))