summaryrefslogtreecommitdiff
path: root/xmpp/jid_test.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-05-25 18:43:12 +0200
committerxengineering <me@xengineering.eu>2023-05-25 18:44:11 +0200
commit8cb0f81d770f01ed06adb71561463418c7fec82a (patch)
treebe864e27d6118d479288fba0e63f4b4ac7b9bfc1 /xmpp/jid_test.go
parent191acba6587b766770cc2bf1d3ff2bc699cb668d (diff)
downloadlimox-8cb0f81d770f01ed06adb71561463418c7fec82a.tar
limox-8cb0f81d770f01ed06adb71561463418c7fec82a.tar.zst
limox-8cb0f81d770f01ed06adb71561463418c7fec82a.zip
Implement first unit test and integrate into build
Diffstat (limited to 'xmpp/jid_test.go')
-rw-r--r--xmpp/jid_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/xmpp/jid_test.go b/xmpp/jid_test.go
new file mode 100644
index 0000000..b900b9c
--- /dev/null
+++ b/xmpp/jid_test.go
@@ -0,0 +1,21 @@
+package xmpp
+
+import (
+ "testing"
+)
+
+func TestDomainpart(t *testing.T) {
+ var data = map[string]string{
+ "user@example.org/ressource": "example.org",
+ "example.org/ressource": "example.org",
+ "user@example.org": "example.org",
+ "example.org": "example.org",
+ "test.eu": "test.eu",
+ }
+
+ for k, v := range(data) {
+ if domainpart(k) != v {
+ t.Fatalf("Domain part of JID '%s' is not '%s'!", k, v)
+ }
+ }
+}