1
0
Fork 0
miniflux/ui/form/settings_test.go
1pav 0d935a863f
Make web app display mode configurable
The change is visible after reinstalling the web app. 

It's not compatible with all browsers.

See https://developer.mozilla.org/en-US/docs/Web/Manifest/display
2021-02-28 13:29:51 -08:00

66 lines
1.3 KiB
Go

package form // import "miniflux.app/ui/form"
import (
"testing"
)
func TestValid(t *testing.T) {
settings := &SettingsForm{
Username: "user",
Password: "hunter2",
Confirmation: "hunter2",
Theme: "default",
Language: "en_US",
Timezone: "UTC",
EntryDirection: "asc",
EntriesPerPage: 50,
DisplayMode: "standalone",
}
err := settings.Validate()
if err != nil {
t.Error(err)
}
}
func TestConfirmationEmpty(t *testing.T) {
settings := &SettingsForm{
Username: "user",
Password: "hunter2",
Confirmation: "",
Theme: "default",
Language: "en_US",
Timezone: "UTC",
EntryDirection: "asc",
EntriesPerPage: 50,
DisplayMode: "standalone",
}
err := settings.Validate()
if err != nil {
t.Error(err)
}
if settings.Password != "" {
t.Error("Password should have been cleared")
}
}
func TestConfirmationIncorrect(t *testing.T) {
settings := &SettingsForm{
Username: "user",
Password: "hunter2",
Confirmation: "unter2",
Theme: "default",
Language: "en_US",
Timezone: "UTC",
EntryDirection: "asc",
EntriesPerPage: 50,
DisplayMode: "standalone",
}
err := settings.Validate()
if err == nil {
t.Error("Validate should return an error")
}
}