Skip to content

Commit a7cb3e6

Browse files
committed
[#11] test adding multiple documents to a collection
1 parent 6d767d8 commit a7cb3e6

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

test/Web/FirestoreCollectionSpec.purs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,19 @@ suite = do
4848
ts = timestamp (seconds 1584696645.0) (microseconds 123456)
4949
geoPoint = point (unsafePartial $ fromJust $ lat 45.666) (unsafePartial $ fromJust $ lon 12.25)
5050
bytes = blob "ꘚ見꿮嬲霃椮줵"
51-
document = DocumentData (fromFoldable [ "text" /\ (primitiveDocument (pvText "some text"))
52-
, "number" /\ (primitiveDocument (pvNumber 273.15 ))
53-
, "bool" /\ (primitiveDocument (pvBoolean true ))
54-
, "null" /\ (primitiveDocument (pvNull ))
55-
, "point" /\ (primitiveDocument (pvGeographicalPoint geoPoint ))
56-
, "datetime" /\ (primitiveDocument (pvDateTime ts ))
57-
, "map" /\ mapDoc
58-
, "array" /\ (arrayDocument [ primitiveArrayValue (pvNumber 273.15)
59-
, arrayMapDoc
60-
])
61-
, "bytes" /\ (primitiveDocument (pvBytes bytes ))
62-
])
51+
document1 = DocumentData (fromFoldable [ "text" /\ (primitiveDocument (pvText "some text"))
52+
, "number" /\ (primitiveDocument (pvNumber 273.15 ))
53+
, "bool" /\ (primitiveDocument (pvBoolean true ))
54+
, "null" /\ (primitiveDocument (pvNull ))
55+
, "point" /\ (primitiveDocument (pvGeographicalPoint geoPoint ))
56+
])
57+
document2 = DocumentData (fromFoldable [ "datetime" /\ (primitiveDocument (pvDateTime ts ))
58+
, "map" /\ mapDoc
59+
, "array" /\ (arrayDocument [ primitiveArrayValue (pvNumber 273.15)
60+
, arrayMapDoc
61+
])
62+
, "bytes" /\ (primitiveDocument (pvBytes bytes ))
63+
])
6364

6465
it "adds documents to a collection" do
6566
testOptions <- buildTestOptions
@@ -75,6 +76,8 @@ suite = do
7576
case maybeCollectionRef of
7677
Nothing -> fail "invalid path"
7778
Just collectionRef -> do
78-
addPromise <- liftEffect $ add collectionRef document
79-
_ <- toAff addPromise
79+
addPromise1 <- liftEffect $ add collectionRef document1
80+
_ <- toAff addPromise1
81+
addPromise2 <- liftEffect $ add collectionRef document2
82+
_ <- toAff addPromise2
8083
pure unit

0 commit comments

Comments
 (0)