This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
otter-space-sdk/pkg/models/const_test.go
SoXX 30fa03ef9a
All checks were successful
Gitea Build Check / Build (push) Successful in 10m40s
feat(postgres): added more tests
Signed-off-by: SoXX <soxx@fenpa.ws>
2024-06-24 14:28:09 +02:00

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)
}
})
}
}