Skip to content
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 .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
global-json-file: global.json
- name: Tests
run: dotnet test -c Release --logger "trx;LogFileName=test-results.trx"
run: dotnet test -c Release --logger "trx;LogFileName=test-results.trx" --logger "console;verbosity=detailed"

# upload test results
- name: Upload dotnet test results
Expand Down
9 changes: 8 additions & 1 deletion src/VahterBanBot.Tests/TgMessageUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ open Telegram.Bot.Types
open Telegram.Bot.Types.Enums

type Tg() =
static let mutable i = 1L // higher than the data in the test_seed.sql
// Start well above all hardcoded IDs used in tests and config to prevent
// auto-generated user/message/chat IDs from colliding with them:
// Vahter IDs: 34, 69 (ALLOWED_USERS) — collision makes isBanAuthorized reject bans silently
// FakeTgApi admin: 42 (/getChatAdministrators)
// Bot user ID: 1337 (BOT_USER_ID)
// Seed user IDs: 1001-1010 (test_seed.sql)
// Seed message IDs: 10001-10499 (test_seed.sql)
static let mutable i = 100_000L
static let nextInt64() = Interlocked.Increment &i
static let next() = nextInt64() |> int
static member user (?id: int64, ?username: string, ?firstName: string) =
Expand Down
2 changes: 1 addition & 1 deletion src/VahterBanBot/FakeTgApi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let fakeTgApi (botConf: BotConfiguration) (request: HttpRequestMessage) =
resp.Content <- new ByteArrayContent(content)
resp.Content.Headers.ContentType <- MediaTypeHeaderValue("application/octet-stream")
resp
elif url.EndsWith "/deleteMessage" || url.EndsWith "/banChatMember" then
elif url.EndsWith "/deleteMessage" || url.EndsWith "/banChatMember" || url.EndsWith "/unbanChatMember" then
// respond with "true"
apiResult "true"
elif url.EndsWith "/sendMessage" then
Expand Down