Merge pull request '12 Сделать добавление транзакций на фронте, добавить уже сгенерированые экраны в проект' (#14) from 12-Add-transactions into main
Build and Deploy / build-and-deploy (push) Failing after 37s
Build and Deploy / build-and-deploy (push) Failing after 37s
Reviewed-on: #14
This commit was merged in pull request #14.
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
package services
|
||||||
|
|
||||||
|
import (
|
||||||
|
"FamilyHub/src/domain"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestBuildReceiptTransactionDescription_UsesNameTO(t *testing.T) {
|
||||||
|
receipt := &domain.Receipt{
|
||||||
|
NameSPD: "Old merchant name",
|
||||||
|
NameTO: "Expected terminal name",
|
||||||
|
ReceiptNumber: "77F05E82C1ED044B07194794",
|
||||||
|
}
|
||||||
|
|
||||||
|
description := buildReceiptTransactionDescription(receipt, nil)
|
||||||
|
if description == nil {
|
||||||
|
t.Fatal("expected description to be set")
|
||||||
|
}
|
||||||
|
|
||||||
|
if *description != "Expected terminal name" {
|
||||||
|
t.Fatalf("expected description %q, got %q", "Expected terminal name", *description)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package receiptProvider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestBuildMultipartBody_NormalizesDateToISO(t *testing.T) {
|
||||||
|
body, _ := buildMultipartBody("07.04.2026", "77F05E82C1ED044B07194794")
|
||||||
|
payload := body.String()
|
||||||
|
|
||||||
|
if !strings.Contains(payload, "2026-04-07") {
|
||||||
|
t.Fatalf("expected ISO date in multipart body, got %q", payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Contains(payload, "07.04.2026") {
|
||||||
|
t.Fatalf("did not expect source date format in multipart body, got %q", payload)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestExtractReceiptMeta_NormalizesOCRDateWithColon(t *testing.T) {
|
||||||
|
text := "Двойной Американо\n1762992079489\n1,000 x 5,50\n5,50\nИТОГО К ОПЛАТЕ:\n5,50\nБП Карта:\n5,50\nКассир:\nср Кто все эти л\nДата и время:\n07:04.2026 08:57:14\nУИ:\n77F05E82C1ED044B07194794"
|
||||||
|
|
||||||
|
meta := ExtractReceiptMeta(text)
|
||||||
|
|
||||||
|
if meta.Date != "07.04.2026" {
|
||||||
|
t.Fatalf("expected normalized date %q, got %q", "07.04.2026", meta.Date)
|
||||||
|
}
|
||||||
|
|
||||||
|
if meta.ReceiptID != "77F05E82C1ED044B07194794" {
|
||||||
|
t.Fatalf("expected receipt id %q, got %q", "77F05E82C1ED044B07194794", meta.ReceiptID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestExtractReceiptMeta_DoesNotTreatTimeAsDate(t *testing.T) {
|
||||||
|
meta := ExtractReceiptMeta("Дата и время:\n08:57:14\nУИ:\n77F05E82C1ED044B07194794")
|
||||||
|
|
||||||
|
if meta.Date != "" {
|
||||||
|
t.Fatalf("expected empty date, got %q", meta.Date)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,6 +39,7 @@ FROM scratch
|
|||||||
|
|
||||||
COPY --from=backend /app/server /server
|
COPY --from=backend /app/server /server
|
||||||
COPY --from=backend /app/migrations /migrations
|
COPY --from=backend /app/migrations /migrations
|
||||||
|
COPY --from=backend /app/src/api/dist /src/api/dist
|
||||||
COPY --from=backend /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
COPY --from=backend /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
COPY --from=backend /usr/share/zoneinfo /usr/share/zoneinfo
|
COPY --from=backend /usr/share/zoneinfo /usr/share/zoneinfo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user