mirror of
https://github.com/stashapp/stash.git
synced 2025-12-08 01:13:09 +01:00
* refactored common code in recommendation row * Implement front page options in config * Allow customisation from front page * Rename recommendations to front page * Add generic UI settings * Support adding premade filters Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
82 lines
1.2 KiB
Go
82 lines
1.2 KiB
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func Test_toSnakeCase(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
v string
|
|
want string
|
|
}{
|
|
{
|
|
"basic",
|
|
"basic",
|
|
"basic",
|
|
},
|
|
{
|
|
"two words",
|
|
"twoWords",
|
|
"two_words",
|
|
},
|
|
{
|
|
"three word value",
|
|
"threeWordValue",
|
|
"three_word_value",
|
|
},
|
|
{
|
|
"snake case",
|
|
"snake_case",
|
|
"snake_case",
|
|
},
|
|
{
|
|
"double capital",
|
|
"doubleCApital",
|
|
"double_capital",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := toSnakeCase(tt.v); got != tt.want {
|
|
t.Errorf("toSnakeCase() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_fromSnakeCase(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
v string
|
|
want string
|
|
}{
|
|
{
|
|
"basic",
|
|
"basic",
|
|
"basic",
|
|
},
|
|
{
|
|
"two words",
|
|
"two_words",
|
|
"twoWords",
|
|
},
|
|
{
|
|
"three word value",
|
|
"three_word_value",
|
|
"threeWordValue",
|
|
},
|
|
{
|
|
"camel case",
|
|
"camelCase",
|
|
"camelCase",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := fromSnakeCase(tt.v); got != tt.want {
|
|
t.Errorf("fromSnakeCase() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|