mirror of
https://gitlab.com/commento/commento.git
synced 2025-06-29 22:56:37 -04:00
api: Add go files
I know this is a huge commit, but I can't be bothered to check this in part by part.
This commit is contained in:
33
api/config_test.go
Normal file
33
api/config_test.go
Normal file
@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseConfigBasics(t *testing.T) {
|
||||
os.Setenv("ORIGIN", "https://commento.io")
|
||||
|
||||
if err := parseConfig(); err != nil {
|
||||
t.Errorf("unexpected error when parsing config: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
// This test feels kinda stupid, but whatever.
|
||||
if os.Getenv("PORT") != "8080" {
|
||||
t.Errorf("expected PORT=8080, but PORT=%s instead", os.Getenv("PORT"))
|
||||
return
|
||||
}
|
||||
|
||||
os.Setenv("PORT", "1886")
|
||||
|
||||
if err := parseConfig(); err != nil {
|
||||
t.Errorf("unexpected error when parsing config: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if os.Getenv("PORT") != "1886" {
|
||||
t.Errorf("expected PORT=1886, but PORT=%s instead", os.Getenv("PORT"))
|
||||
return
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user