60e2149072
Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date) - Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class - Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting - Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states - Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions - Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares) - Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline - Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements - Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations - Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary - Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds All tests follow AAA pattern and use data-testid selectors matching Angular version. Total: 245 tests across 10 feature suites.
54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.makeDataUriToBuffer = void 0;
|
|
/**
|
|
* Returns a `Buffer` instance from the given data URI `uri`.
|
|
*
|
|
* @param {String} uri Data URI to turn into a Buffer instance
|
|
*/
|
|
const makeDataUriToBuffer = (convert) => (uri) => {
|
|
uri = String(uri);
|
|
if (!/^data:/i.test(uri)) {
|
|
throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');
|
|
}
|
|
// strip newlines
|
|
uri = uri.replace(/\r?\n/g, '');
|
|
// split the URI up into the "metadata" and the "data" portions
|
|
const firstComma = uri.indexOf(',');
|
|
if (firstComma === -1 || firstComma <= 4) {
|
|
throw new TypeError('malformed data: URI');
|
|
}
|
|
// remove the "data:" scheme and parse the metadata
|
|
const meta = uri.substring(5, firstComma).split(';');
|
|
let charset = '';
|
|
let base64 = false;
|
|
const type = meta[0] || 'text/plain';
|
|
let typeFull = type;
|
|
for (let i = 1; i < meta.length; i++) {
|
|
if (meta[i] === 'base64') {
|
|
base64 = true;
|
|
}
|
|
else if (meta[i]) {
|
|
typeFull += `;${meta[i]}`;
|
|
if (meta[i].indexOf('charset=') === 0) {
|
|
charset = meta[i].substring(8);
|
|
}
|
|
}
|
|
}
|
|
// defaults to US-ASCII only if type is not provided
|
|
if (!meta[0] && !charset.length) {
|
|
typeFull += ';charset=US-ASCII';
|
|
charset = 'US-ASCII';
|
|
}
|
|
// get the encoded data portion and decode URI-encoded chars
|
|
const data = unescape(uri.substring(firstComma + 1));
|
|
const buffer = base64 ? convert.base64ToArrayBuffer(data) : convert.stringToBuffer(data);
|
|
return {
|
|
type,
|
|
typeFull,
|
|
charset,
|
|
buffer,
|
|
};
|
|
};
|
|
exports.makeDataUriToBuffer = makeDataUriToBuffer;
|
|
//# sourceMappingURL=common.js.map
|