Files
ntfy-bridge/gitea_test.v
T
bruno 4e1d7cd94a Add config validation and dashboard
Add YAML config loading with validation, env overrides for secrets, and
a web dashboard exposing health, stats, and recent events.
2026-08-03 12:12:12 -04:00

38 lines
1.1 KiB
V

module main
import sources
fn test_transform_gitea_push() {
raw := '{"repository":{"full_name":"bruno/flowdeck"},"pusher":{"username":"bruno"},"commits":[{"message":"Fix bug","id":"a3f2c1d1234567890"}]}'
src := sources.GiteaSource{
name: 'FlowDeck'
webhook_path: '/webhooks/gitea-flowdeck'
topic: 'dev-notifs'
priority_map: {
'push': 2
}
}
event := sources.transform_gitea(raw, src) or { panic(err) }
assert event.source == 'gitea'
assert event.topic == 'dev-notifs'
assert event.priority == 2
assert event.message.contains('bruno/flowdeck')
assert event.message.contains('bruno')
assert event.message.contains('Fix bug')
}
fn test_transform_gitea_pull_request() {
raw := '{"repository":{"full_name":"bruno/flowdeck"},"action":"opened","pull_request":{"title":"New feature","merge_commit_sha":"abc123"}}'
src := sources.GiteaSource{
name: 'FlowDeck'
webhook_path: '/webhooks/gitea-flowdeck'
topic: 'dev-notifs'
priority_map: {
'pull_request': 4
}
}
event := sources.transform_gitea(raw, src) or { panic(err) }
assert event.priority == 4
assert event.message.contains('New feature')
}