Skip to content

Commit 0718b88

Browse files
author
Jamil Maqdis Anton
committed
Add two tests
1 parent 1d0d98b commit 0718b88

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

tests/AppendTests.fs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
module Tests
2+
3+
open Expecto
4+
open SqlStreamStore.FSharp
5+
open SqlStreamStore.FSharp.Tests
6+
7+
8+
[<Tests>]
9+
let tests =
10+
testList
11+
"Append Tests"
12+
[ testAsync "Should append one message to stream." {
13+
let inMemStore = new SqlStreamStore.InMemoryStreamStore()
14+
15+
let appendStream: AppendStreamDetails =
16+
{ streamName = "test"
17+
version = AppendVersion.NoStream }
18+
19+
let msg =
20+
{ id = StreamMessageId.Auto
21+
type_ = "testing"
22+
jsonData = "{}"
23+
jsonMetadata = "{}" }
24+
25+
let! appendResult = Append.appendNewMessage inMemStore appendStream msg
26+
27+
ExpectExtra.equal 0 appendResult.CurrentVersion
28+
}
29+
30+
testAsync "Should append a list of messages to stream." {
31+
let inMemStore = new SqlStreamStore.InMemoryStreamStore()
32+
33+
let appendStream: AppendStreamDetails =
34+
{ streamName = "test"
35+
version = AppendVersion.NoStream }
36+
37+
let msg1 =
38+
{ id = StreamMessageId.Auto
39+
type_ = "testing"
40+
jsonData = "{}"
41+
jsonMetadata = "{}" }
42+
43+
let msg2 =
44+
{ id = StreamMessageId.Auto
45+
type_ = "testing"
46+
jsonData = "{}"
47+
jsonMetadata = "{}" }
48+
49+
let msgList = [ msg1; msg2 ]
50+
51+
let! appendResult = Append.appendNewMessages inMemStore appendStream msgList
52+
ExpectExtra.equal 1 appendResult.CurrentVersion
53+
} ]

0 commit comments

Comments
 (0)