forked from matrix-org/sliding-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhome_server_url_test.go
More file actions
30 lines (23 loc) · 884 Bytes
/
home_server_url_test.go
File metadata and controls
30 lines (23 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package internal
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestHomeServerUrl_IsUnixSocket_True(t *testing.T) {
assert.True(t, HomeServerUrl{"/path/to/socket"}.IsUnixSocket())
}
func TestHomeServerUrl_IsUnixSocket_False(t *testing.T) {
assert.False(t, HomeServerUrl{"localhost:8080"}.IsUnixSocket())
}
func TestHomeServerUrl_GetUnixSocket(t *testing.T) {
assert.Equal(t, "/path/to/socket", HomeServerUrl{"/path/to/socket"}.GetUnixSocket())
}
func TestHomeServerUrl_GetUnixSocket_Http(t *testing.T) {
assert.Equal(t, "", HomeServerUrl{"localhost:8080"}.GetUnixSocket())
}
func TestHomeServerUrl_GetBaseUrl_UnixSocket(t *testing.T) {
assert.Equal(t, "http://unix", HomeServerUrl{"/path/to/socket"}.GetBaseUrl())
}
func TestHomeServerUrl_GetBaseUrl_Http(t *testing.T) {
assert.Equal(t, "localhost:8080", HomeServerUrl{"localhost:8080"}.GetBaseUrl())
}