Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more seed data #41

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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