<commit_before>module Test.RefSpec (refSpec) where

import Control.Monad.Eff.Class (liftEff)
import Data.Maybe (Maybe(Just, Nothing))
import Prelude (Unit, bind, discard, ($), (>>=), (<>))
import Test.Spec (describe, it, Spec)
import Test.Spec.Assertions (shouldEqual)
import Test.Spec.Assertions.Aff (expectError)
import Web.Firebase (child, key, toString)
import Web.Firebase.Aff as FAff
import Web.Firebase.Types as FBT
import Web.Firebase.UnsafeRef (refFor)

refSpec :: forall eff. FBT.Firebase -> Spec (firebase :: FBT.FirebaseEff | eff) Unit
refSpec ref = do
 describe "A reference in" do
   describe "Eff" do
     it "root reference is Nothing" do
       let rootKey = key ref
       rootKey `shouldEqual` Nothing
     it "key of root refences' child is child" do
       actual <- liftEff $ (child "achild" ref)
       (key actual) `shouldEqual` (Just "achild")
     describe "toString" do
       it "on root represents full database URl" do
         actual <- liftEff $ toString ref
         actual `shouldEqual` "https://purescript-spike.firebaseio.com/"
       it "on child represents full database URl plus child" do
         actual <- liftEff $ (child "achild" ref) >>= toString
         actual `shouldEqual` "https://purescript-spike.firebaseio.com/achild"
     describe "Aff" do
       describe "Getting a key" do
        it "on root throws an error" do
          expectError $ FAff.key ref
        it "on child of root returns child" do
          actual <- (FAff.child "affchild" ref) >>= FAff.key
          actual `shouldEqual` "affchild"
       describe "toString" do
         it "on root returns url" do
           actual <- FAff.toString ref
           actual `shouldEqual` "https://purescript-spike.firebaseio.com/"
         it "on child of root returns root url + child" do
           let child = "achild"
           actual <- (FAff.child child ref) >>= FAff.toString
           actual `shouldEqual` ("https://purescript-spike.firebaseio.com/" <> child)
<commit_msg>Fix indentation, remove import<commit_after>module Test.RefSpec (refSpec) where

import Control.Monad.Eff.Class (liftEff)
import Data.Maybe (Maybe(Just, Nothing))
import Prelude (Unit, bind, discard, ($), (>>=), (<>))
import Test.Spec (describe, it, Spec)
import Test.Spec.Assertions (shouldEqual)
import Test.Spec.Assertions.Aff (expectError)
import Web.Firebase (child, key, toString)
import Web.Firebase.Aff as FAff
import Web.Firebase.Types as FBT

refSpec :: forall eff. FBT.Firebase -> Spec (firebase :: FBT.FirebaseEff | eff) Unit
refSpec ref = do
 describe "A reference in" do
   describe "Eff" do
     it "root reference is Nothing" do
       let rootKey = key ref
       rootKey `shouldEqual` Nothing
     it "key of root refences' child is child" do
       actual <- liftEff $ (child "achild" ref)
       (key actual) `shouldEqual` (Just "achild")
     describe "toString" do
       it "on root represents full database URl" do
         actual <- liftEff $ toString ref
         actual `shouldEqual` "https://purescript-spike.firebaseio.com/"
       it "on child represents full database URl plus child" do
         actual <- liftEff $ (child "achild" ref) >>= toString
         actual `shouldEqual` "https://purescript-spike.firebaseio.com/achild"
   describe "Aff" do
     describe "Getting a key" do
       it "on root throws an error" do
         expectError $ FAff.key ref
       it "on child of root returns child" do
         actual <- (FAff.child "affchild" ref) >>= FAff.key
         actual `shouldEqual` "affchild"
     describe "toString" do
       it "on root returns url" do
         actual <- FAff.toString ref
         actual `shouldEqual` "https://purescript-spike.firebaseio.com/"
       it "on child of root returns root url + child" do
         let child = "achild"
         actual <- (FAff.child child ref) >>= FAff.toString
         actual `shouldEqual` ("https://purescript-spike.firebaseio.com/" <> child)

{'fraction_non_alphanumeric': 0.10975299210593328, 'fraction_numerical': 0.0, 'mean_word_length': 2.850980392156863, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5767468', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1185, 'n_words': 406}