mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
This commit standardizes the naming of identifier and API key fields across the codebase to use consistent camel case (e.g., `ID`, `APIKey`, `DatabaseURL`). This includes updates to struct fields, method names, function parameters, and environment variable references. The changes improve code clarity and maintainability by reducing ambiguity and aligning with Go naming conventions. No functional behavior is changed.
77 lines
2.8 KiB
Go
77 lines
2.8 KiB
Go
package parser
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestBookingAgentParser_Parse(t *testing.T) {
|
|
input := ` Date d'arrivée jeu. 3 avr. 2025 Date de départ dim. 6 avr. 2025 Durée de séjour : 3 nuits Nombre de personnes :
|
|
2
|
|
Nombre d'hébergements
|
|
1
|
|
Montant total € 186 Nom du client :
|
|
Olga Korovina
|
|
|
|
ru
|
|
|
|
okorov.905387@guest.booking.com
|
|
Contactez vos clients ! Indiquez-leur l'heure à laquelle vous souhaitez les accueillir ou l'endroit où ils récupéreront leurs clés. Un simple appel suffit : Afficher le numéro de téléphone Vous pouvez également leur envoyer un e-mail ou un message. Langue préférée
|
|
russe
|
|
Canal : Booking.com Code IATA/TIDS :
|
|
PC029090
|
|
Numéro de réservation :
|
|
4453602306
|
|
Montant soumis à commission : € 177 Reçu jeu. 2 janv. 2025 Commission : € 31,86 Bloc-notes (usage interne) Ajoutez une note ici
|
|
|
|
Maison 1 Chambre T2 - VillaFleurie au bourg du Gosier)
|
|
€ 186 jeu. 3 avr. 2025 dim. 6 avr. 2025 Nom du client
|
|
Olga Korovina
|
|
Occupation maximum 2 adultes, 2 enfants (3 personnes max.) Photo de l'hébergement Date Tarif Tarif par nuit
|
|
03 - 04 avril
|
|
|
|
Standard Rate
|
|
€ 59
|
|
04 - 05 avril
|
|
|
|
Standard Rate
|
|
€ 59
|
|
05 - 06 avril
|
|
|
|
Standard Rate
|
|
€ 59Sous-total € 177
|
|
Taxe de séjour
|
|
€ 1.50 par personne et par nuit € 9Tarif total de l'hébergement € 186 Le tarif comprend 8.9 % de TVA Conversation avec le client
|
|
Aucun message
|
|
|
|
Les conversations avec vos clients apparaîtront ici.
|
|
Booking.com reçoit tous les messages écrits ici et les traite selon sa Charte de confidentialité et informations sur les cookies Conditions `
|
|
|
|
parser := NewBookingAgentParser()
|
|
booking, err := parser.Parse(input)
|
|
if err != nil {
|
|
t.Fatalf("Parse failed: %v", err)
|
|
}
|
|
|
|
if booking.Name != "Olga Korovina" {
|
|
t.Errorf("expected Name 'Olga Korovina', got '%s'", booking.Name)
|
|
}
|
|
if booking.Email != "okorov.905387@guest.booking.com" {
|
|
t.Errorf("expected Email 'okorov.905387@guest.booking.com', got '%s'", booking.Email)
|
|
}
|
|
if booking.Platform != "Booking" {
|
|
t.Errorf("expected Platform 'Booking', got '%s'", booking.Platform)
|
|
}
|
|
if booking.ExternalID == nil || *booking.ExternalID != "4453602306" {
|
|
t.Errorf("expected ExternalId '4453602306', got '%v'", booking.ExternalID)
|
|
}
|
|
if !booking.From.Equal(time.Date(2025, 4, 3, 0, 0, 0, 0, time.UTC)) {
|
|
t.Errorf("expected From 2025-04-03, got %v", booking.From)
|
|
}
|
|
if !booking.To.Equal(time.Date(2025, 4, 6, 0, 0, 0, 0, time.UTC)) {
|
|
t.Errorf("expected To 2025-04-06, got %v", booking.To)
|
|
}
|
|
if len(booking.Items) == 0 {
|
|
t.Errorf("expected at least one item, got 0")
|
|
}
|
|
}
|