Skip to content

test: Add integration tests for Telegram bot role authorization - #1001

Merged
Mosas2000 merged 1 commit into
StellaBridge:mainfrom
Escelit:test/telegram-bot-auth-integration
Jul 30, 2026
Merged

test: Add integration tests for Telegram bot role authorization#1001
Mosas2000 merged 1 commit into
StellaBridge:mainfrom
Escelit:test/telegram-bot-auth-integration

Conversation

@Escelit

@Escelit Escelit commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Closes #974

Adds backend/tests/integration/telegramBotAuth.test.ts with 10 integration tests verifying that unauthorized Telegram user IDs are rejected when invoking admin commands (/pause, /resume).

Test scenarios

isAdminChat with real database

  • Rejects chat not found in admin_accounts or bootstrap list
  • Grants access for operator and super_admin roles
  • Denies access for auditor and viewer roles
  • Denies access for inactive admin accounts
  • Denies access for non-existent telegram_chat_id
  • Correctly handles multiple accounts with mixed roles

Admin command handlers

  • /pause replies "❌ Unauthorized" for non-admin chat
  • /resume replies "❌ Unauthorized" for non-admin chat

Testing

All 10 tests pass against a real PostgreSQL database. Existing telegram service and role auth unit tests remain unaffected.

Add backend/tests/integration/telegramBotAuth.test.ts with 10 tests
verifying that unauthorized Telegram user IDs are rejected when
invoking admin commands.

Tests cover:
- operator and super_admin roles grant access
- auditor and viewer roles deny access
- inactive admin accounts deny access
- non-existent telegram_chat_id denied access
- /pause and /resume command handlers reject unauthorized chats
@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Escelit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Mosas2000
Mosas2000 merged commit e9f0b03 into StellaBridge:main Jul 30, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Add integration tests for Telegram bot role authorization

2 participants