Harden pricelist formation and document architecture decisions
This commit is contained in:
33
internal/services/pricing/service_meta_test.go
Normal file
33
internal/services/pricing/service_meta_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package pricing
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestExpandMetaPricesWithCache_IncludesBaseLotAndDeduplicates(t *testing.T) {
|
||||
allLots := []string{
|
||||
"SSD_NVMe_03.2T",
|
||||
"SSD_NVMe_03.2T_OEM",
|
||||
"SSD_NVMe_03.2T_ES",
|
||||
}
|
||||
|
||||
got := expandMetaPricesWithCache(
|
||||
"SSD_NVMe_03.2T,SSD_NVMe_03.2T*,SSD_NVMe_03.2T_OEM",
|
||||
"SSD_NVMe_03.2T",
|
||||
allLots,
|
||||
)
|
||||
|
||||
want := []string{
|
||||
"SSD_NVMe_03.2T",
|
||||
"SSD_NVMe_03.2T_OEM",
|
||||
"SSD_NVMe_03.2T_ES",
|
||||
}
|
||||
|
||||
if len(got) != len(want) {
|
||||
t.Fatalf("unexpected result length: got=%d want=%d; values=%v", len(got), len(want), got)
|
||||
}
|
||||
for i := range want {
|
||||
if got[i] != want[i] {
|
||||
t.Fatalf("unexpected value at %d: got=%q want=%q; full=%v", i, got[i], want[i], got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user