Skip to content

Commit

Permalink
(#102) LinkGeneratorTests: test basic generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Oct 3, 2021
1 parent 1177910 commit 2e063dc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions Emulsion.Tests/Emulsion.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Compile Include="MessageSystemTests\MessageSystemBaseTests.fs" />
<Compile Include="Telegram\Html.fs" />
<Compile Include="Telegram\FunogramTests.fs" />
<Compile Include="Telegram\LinkGeneratorTests.fs" />
<Compile Include="Xmpp\SharpXmppPingHandlerTests.fs" />
<Compile Include="Xmpp\XmppClientFactory.fs" />
<Compile Include="Xmpp\XmppMessageFactory.fs" />
Expand Down
32 changes: 32 additions & 0 deletions Emulsion.Tests/Telegram/LinkGeneratorTests.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module Emulsion.Tests.Telegram.LinkGeneratorTests

open Emulsion.Telegram
open Funogram.Telegram.Types
open Xunit

let private chatName = "test_chat"
let private messageTemplate =
{ defaultMessage with
Chat =
{ defaultChat with
Type = SuperGroup
Username = Some chatName
}
}

let private doBasicLinkTest message =
let links = Async.RunSynchronously(LinkGenerator.gatherLinks message)
Assert.Equal(Some $"https://t.me/{chatName}/{message.MessageId}", links.ContentLink)

[<Fact>]
let documentLinkTest(): unit =
doBasicLinkTest
{ messageTemplate with
Document = Some {
FileId = ""
Thumb = None
FileName = None
MimeType = None
FileSize = None
}
}

0 comments on commit 2e063dc

Please sign in to comment.