SoXX
30fa03ef9a
All checks were successful
Gitea Build Check / Build (push) Successful in 10m40s
Signed-off-by: SoXX <soxx@fenpa.ws>
60 lines
932 B
Go
60 lines
932 B
Go
package models
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestRating_Convert(t *testing.T) {
|
|
type args struct {
|
|
e621Rating string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
r *Rating
|
|
args args
|
|
want Rating
|
|
}{
|
|
{
|
|
name: "Test 1: NSFW Rating",
|
|
r: new(Rating),
|
|
args: args{
|
|
e621Rating: "e",
|
|
},
|
|
want: NSFW,
|
|
},
|
|
{
|
|
name: "Test 2: Questionable Rating",
|
|
r: new(Rating),
|
|
args: args{
|
|
e621Rating: "q",
|
|
},
|
|
want: Questionable,
|
|
},
|
|
{
|
|
name: "Test 3: SFW Rating",
|
|
r: new(Rating),
|
|
args: args{
|
|
e621Rating: "s",
|
|
},
|
|
want: SFW,
|
|
},
|
|
{
|
|
name: "Test 4: Unknown Rating",
|
|
r: new(Rating),
|
|
args: args{
|
|
e621Rating: "x",
|
|
},
|
|
want: Unknown,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
tt.r.Convert(tt.args.e621Rating)
|
|
if !reflect.DeepEqual(*tt.r, tt.want) {
|
|
t.Errorf("Convert() = %v, want %v", *tt.r, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|