Implement global vendor mappings with bundle support and seen-based ignore

This commit is contained in:
Mikhail Chusavitin
2026-02-18 19:54:07 +03:00
parent b94dd3d015
commit c22328bf03
21 changed files with 2048 additions and 342 deletions

View File

@@ -77,6 +77,46 @@ func TestParseMXLRows_EmptyQtyMarkedInvalid(t *testing.T) {
}
}
func TestParseMXLRows_WithAdditionalLeadingColumn(t *testing.T) {
content := strings.Join([]string{
`MOXCEL`,
`{16,2,{1,1,{"ru","код"}},0},1,`,
`{16,3,{1,1,{"ru","Папка"}},0},2,`,
`{16,3,{1,1,{"ru","Артикул"}},0},3,`,
`{16,3,{1,1,{"ru","Описание"}},0},4,`,
`{16,4,{1,1,{"ru","Вендор"}},0},5,`,
`{16,3,{1,1,{"ru","Стоимость"}},0},6,`,
`{16,3,{1,1,{"ru","Свободно"}},0},7,`,
`{16,6,{1,1,{"ru","n0000001"}},0},1,`,
`{16,6,{1,1,{"ru","Серверы"}},0},2,`,
`{16,7,{1,1,{"ru","CPU_X"}},0},3,`,
`{16,8,{1,1,{"ru","Процессор"}},0},4,`,
`{16,8,{1,1,{"ru","AMD"}},0},5,`,
`{16,9,{1,1,{"ru","125,50"}},0},6,`,
`{16,10,{1,1,{"ru","10"}},0},7,`,
}, "\n")
rows, err := parseMXLRows([]byte(content))
if err != nil {
t.Fatalf("parseMXLRows: %v", err)
}
if len(rows) != 1 {
t.Fatalf("expected 1 row, got %d", len(rows))
}
if rows[0].Article != "CPU_X" {
t.Fatalf("unexpected article: %s", rows[0].Article)
}
if rows[0].Folder != "Серверы" {
t.Fatalf("unexpected folder: %s", rows[0].Folder)
}
if rows[0].Price != 125.50 {
t.Fatalf("unexpected price: %v", rows[0].Price)
}
if rows[0].Qty != 10 {
t.Fatalf("unexpected qty: %v", rows[0].Qty)
}
}
func TestParseXLSXRows(t *testing.T) {
xlsx := buildMinimalXLSX(t, []string{
"Папка", "Артикул", "Описание", "Вендор", "Стоимость", "Свободно",