Commit 442e4a38 authored by Volker Krause's avatar Volker Krause
Browse files

Test merging a minimal cancellation element with its full reservation

This does the right thing already, the problem is more in validation and
sorting prior to this.
parent 5c3f2399
[{
"internal-comment": "sample from https://developers.google.com/gmail/markup/reference/flight-reservation#cancel_a_flight",
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationNumber": "RXJ34P",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"@type": "Person",
"name": "Eva Green"
},
"reservationFor": {
"@type": "Flight",
"flightNumber": "110",
"airline": {
"@type": "Airline",
"name": "United",
"iataCode": "UA"
},
"departureAirport": {
"@type": "Airport",
"name": "San Francisco Airport",
"iataCode": "SFO"
},
"departureTime": "2027-03-04T20:15:00-08:00",
"arrivalAirport": {
"@type": "Airport",
"name": "John F. Kennedy International Airport",
"iataCode": "JFK"
},
"arrivalTime": "2027-03-05T06:30:00-05:00"
},
"modifiedTime": "2027-01-01T08:30:00-08:00"
}]
[
{
"@context": "http://schema.org",
"@type": "FlightReservation",
"modifiedTime": "2027-02-01T08:30:00-08:00",
"reservationFor": {
"@type": "Flight",
"airline": {
"@type": "Airline",
"iataCode": "UA",
"name": "United"
},
"arrivalAirport": {
"@type": "Airport",
"iataCode": "JFK",
"name": "John F. Kennedy International Airport"
},
"arrivalTime": "2027-03-05T06:30:00-05:00",
"departureAirport": {
"@type": "Airport",
"iataCode": "SFO",
"name": "San Francisco Airport"
},
"departureDay": "2027-03-04",
"departureTime": "2027-03-04T20:15:00-08:00",
"flightNumber": "110"
},
"reservationNumber": "RXJ34P",
"reservationStatus": "http://schema.org/ReservationCancelled",
"underName": {
"@type": "Person",
"name": "Eva Green"
}
}
]
[{
"@context": "http://schema.org",
"@type": "FlightReservation",
"reservationNumber": "RXJ34P",
"reservationStatus": "http://schema.org/Cancelled",
"modifiedTime": "2027-02-01T08:30:00-08:00"
}]
......@@ -305,12 +305,18 @@ private Q_SLOTS:
const auto expected = QJsonDocument::fromJson(readFile(baseName + QLatin1String(".merged.json")));
const auto mergedL2R = MergeUtil::merge(lhs, rhs);
//qDebug().noquote() << QJsonDocument(JsonLdDocument::toJson({mergedL2R})).toJson();
QCOMPARE(QJsonDocument(JsonLdDocument::toJson(QVector<QVariant>({mergedL2R}))), expected);
auto mergedJson = QJsonDocument(JsonLdDocument::toJson(QVector<QVariant>({mergedL2R})));
if (mergedJson != expected) {
qDebug().noquote() << mergedJson.toJson();
}
QCOMPARE(mergedJson, expected);
const auto mergedR2L = MergeUtil::merge(rhs, lhs);
//qDebug().noquote() << QJsonDocument(JsonLdDocument::toJson({m5ergedR2L})).toJson();
QCOMPARE(QJsonDocument(JsonLdDocument::toJson(QVector<QVariant>({mergedR2L}))), expected);
mergedJson = QJsonDocument(JsonLdDocument::toJson(QVector<QVariant>({mergedR2L})));
if (mergedJson != expected) {
qDebug().noquote() << mergedJson.toJson();
}
QCOMPARE(mergedJson, expected);
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment