Skip to content

Commit

Permalink
more seed data (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
Szer authored Jul 22, 2024
1 parent 788af94 commit 8c6cd50
Show file tree
Hide file tree
Showing 3 changed files with 577 additions and 128 deletions.
2 changes: 1 addition & 1 deletion src/VahterBanBot.Tests/ContainerTestBase.fs
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,4 @@ type MlAwaitFixture() =
interface IAsyncLifetime with
member this.DisposeAsync() = Task.CompletedTask
// we assume 5 seconds is enough for model to train. Could be flaky
member this.InitializeAsync() = Task.Delay 5000
member this.InitializeAsync() = Task.Delay 10000
12 changes: 6 additions & 6 deletions src/VahterBanBot.Tests/MLBanTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type MLBanTests(fixture: VahterTestContainers, _unused: MlAwaitFixture) =
let ``Message IS autobanned if it looks like a spam`` () = task {
// record a message, where 2 is in a training set as spam word
// ChatsToMonitor[0] doesn't have stopwords
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "2")
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "2222222")
let! _ = fixture.SendMessage msgUpdate

// assert that the message got auto banned
Expand All @@ -25,7 +25,7 @@ type MLBanTests(fixture: VahterTestContainers, _unused: MlAwaitFixture) =
// record a message, where 2 is in a training set as spam word
// ChatsToMonitor[0] doesn't have stopwords
// but it was sent by vahter
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "2", from = fixture.AdminUsers[0])
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "2222222", from = fixture.AdminUsers[0])
let! _ = fixture.SendMessage msgUpdate

// assert that the message got auto banned
Expand All @@ -37,7 +37,7 @@ type MLBanTests(fixture: VahterTestContainers, _unused: MlAwaitFixture) =
let ``Message is NOT autobanned if it has a stopword in specific chat`` () = task {
// record a message, where 2 is in a training set as spam word
// ChatsToMonitor[1] does have a stopword 2
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[1], text = "2")
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[1], text = "2222222")
let! _ = fixture.SendMessage msgUpdate

// assert that the message got auto banned
Expand All @@ -59,7 +59,7 @@ type MLBanTests(fixture: VahterTestContainers, _unused: MlAwaitFixture) =
[<Fact>]
let ``Message IS autobanned if it is a known false-negative spam`` () = task {
// record a message, where 3 is in a training set as false negative spam word
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "3")
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "3333333")
let! _ = fixture.SendMessage msgUpdate

// assert that the message got auto banned
Expand All @@ -71,7 +71,7 @@ type MLBanTests(fixture: VahterTestContainers, _unused: MlAwaitFixture) =
let ``If message got auto-deleted we can mark it as false-positive with a button click`` () = task {
// record a message, where 2 is in a training set as spam word
// ChatsToMonitor[0] doesn't have stopwords
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "7")
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "7777777")
let! _ = fixture.SendMessage msgUpdate

// assert that the message got auto banned
Expand All @@ -95,7 +95,7 @@ type MLBanTests(fixture: VahterTestContainers, _unused: MlAwaitFixture) =
let ``Only vahter can press THE BUTTON(s)`` () = task {
// record a message, where 2 is in a training set as spam word
// ChatsToMonitor[0] doesn't have stopwords
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "6")
let msgUpdate = Tg.quickMsg(chat = fixture.ChatsToMonitor[0], text = "66666666")
let! _ = fixture.SendMessage msgUpdate

// assert that the message got auto banned
Expand Down
Loading

0 comments on commit 8c6cd50

Please sign in to comment.