From 4daf50d9ce88715953b13db43fdc70859edb19a8 Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Tue, 7 Jan 2020 15:29:27 -0800 Subject: [PATCH] Take a more granular approach to checking descriptions. --- src/test/lemondronor/circlebot_test.cljs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/test/lemondronor/circlebot_test.cljs b/src/test/lemondronor/circlebot_test.cljs index 827c489..e597531 100644 --- a/src/test/lemondronor/circlebot_test.cljs +++ b/src/test/lemondronor/circlebot_test.cljs @@ -128,7 +128,10 @@ 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" (let [ac {:icao "B00B00"} sqb {:registration "NGOODB0Y" @@ -137,7 +140,10 @@ wiki-nearby {} nearby {:name "Disneyland" :distance 2} 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" (let [ac {:military? false :alt 1300 :speed 72.1 :squawk "1200" :icao "AAE0C2" :type nil, :callsign "N80NT", :registration nil} @@ -146,4 +152,11 @@ wiki-nearby {} nearby {:name "Disneyland" :distance 2} 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)))))