add small and useless test
This commit is contained in:
45
pkg/itemfilter/itemfilter_test.go
Normal file
45
pkg/itemfilter/itemfilter_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package itemfilter
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hectorgimenez/d2go/pkg/data"
|
||||
"github.com/hectorgimenez/d2go/pkg/data/item"
|
||||
"github.com/hectorgimenez/d2go/pkg/nip"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestEvaluate(t *testing.T) {
|
||||
type args struct {
|
||||
i data.Item
|
||||
nipRule string // not the best test but too lazy to write rules manually
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "",
|
||||
args: args{
|
||||
i: data.Item{
|
||||
Name: item.Name("lightplatedboots"),
|
||||
Quality: item.QualityUnique,
|
||||
Ethereal: false,
|
||||
},
|
||||
nipRule: "[name] == lightplatedboots && [quality] == unique && [flag] != ethereal # [enhanceddefense] == 60 // goblin toe",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
rule, err := nip.ParseLine(tt.args.nipRule)
|
||||
require.NoError(t, err)
|
||||
|
||||
if got := Evaluate(tt.args.i, []nip.Rule{rule}); got != tt.want {
|
||||
t.Errorf("Evaluate() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user