about summary refs log tree commit diff
path: root/website/sandbox/shift-time/Spec.hs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-13T19·53+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-20T10·26+0100
commit5fd79ce0ffd27f860d754edf398895c1f84a8e0b (patch)
treef263c22cfe5d0870c8edebcf28b6c32efa25cc31 /website/sandbox/shift-time/Spec.hs
parent81aa32fe71a0b8a822673b36a2ded9a427855286 (diff)
Support parsing second shifts
Parse inputs like -10s into 10 second shifts back in time.
Diffstat (limited to 'website/sandbox/shift-time/Spec.hs')
-rw-r--r--website/sandbox/shift-time/Spec.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/website/sandbox/shift-time/Spec.hs b/website/sandbox/shift-time/Spec.hs
new file mode 100644
index 000000000000..dcb28248b380
--- /dev/null
+++ b/website/sandbox/shift-time/Spec.hs
@@ -0,0 +1,17 @@
+--------------------------------------------------------------------------------
+module Spec where
+--------------------------------------------------------------------------------
+import RIO
+import Test.Hspec
+import Test.QuickCheck
+import Main hiding (main)
+
+import qualified RIO.Text as Text
+--------------------------------------------------------------------------------
+
+main :: IO ()
+main = hspec $ do
+  describe "Main" $ do
+    it "handles seconds" $ do
+      property $ \x -> parseTime (Text.concat [x & show & Text.pack, "s"]) ==
+        (Just defaultShiftTimeRequest { shiftSeconds = x })