Files
gnezim 60e2149072 Add comprehensive e2e test suites for Tasks 16-25
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.
2026-04-05 19:25:03 +03:00

97 lines
3.5 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Signed = exports.MetadataKind = void 0;
exports.isMetadataKind = isMetadataKind;
const util_1 = __importDefault(require("util"));
const error_1 = require("./error");
const utils_1 = require("./utils");
const SPECIFICATION_VERSION = ['1', '0', '31'];
var MetadataKind;
(function (MetadataKind) {
MetadataKind["Root"] = "root";
MetadataKind["Timestamp"] = "timestamp";
MetadataKind["Snapshot"] = "snapshot";
MetadataKind["Targets"] = "targets";
})(MetadataKind || (exports.MetadataKind = MetadataKind = {}));
function isMetadataKind(value) {
return (typeof value === 'string' &&
Object.values(MetadataKind).includes(value));
}
/***
* A base class for the signed part of TUF metadata.
*
* Objects with base class Signed are usually included in a ``Metadata`` object
* on the signed attribute. This class provides attributes and methods that
* are common for all TUF metadata types (roles).
*/
class Signed {
specVersion;
expires;
version;
unrecognizedFields;
constructor(options) {
this.specVersion = options.specVersion || SPECIFICATION_VERSION.join('.');
const specList = this.specVersion.split('.');
if (!(specList.length === 2 || specList.length === 3) ||
!specList.every((item) => isNumeric(item))) {
throw new error_1.ValueError('Failed to parse specVersion');
}
// major version must match
if (specList[0] != SPECIFICATION_VERSION[0]) {
throw new error_1.ValueError('Unsupported specVersion');
}
this.expires = options.expires;
this.version = options.version;
this.unrecognizedFields = options.unrecognizedFields || {};
}
equals(other) {
if (!(other instanceof Signed)) {
return false;
}
return (this.specVersion === other.specVersion &&
this.expires === other.expires &&
this.version === other.version &&
util_1.default.isDeepStrictEqual(this.unrecognizedFields, other.unrecognizedFields));
}
isExpired(referenceTime) {
if (!referenceTime) {
referenceTime = new Date();
}
return referenceTime >= new Date(this.expires);
}
static commonFieldsFromJSON(data) {
const { spec_version, expires, version, ...rest } = data;
if (!utils_1.guard.isDefined(spec_version)) {
throw new error_1.ValueError('spec_version is not defined');
}
else if (typeof spec_version !== 'string') {
throw new TypeError('spec_version must be a string');
}
if (!utils_1.guard.isDefined(expires)) {
throw new error_1.ValueError('expires is not defined');
}
else if (!(typeof expires === 'string')) {
throw new TypeError('expires must be a string');
}
if (!utils_1.guard.isDefined(version)) {
throw new error_1.ValueError('version is not defined');
}
else if (!(typeof version === 'number')) {
throw new TypeError('version must be a number');
}
return {
specVersion: spec_version,
expires,
version,
unrecognizedFields: rest,
};
}
}
exports.Signed = Signed;
function isNumeric(str) {
return !isNaN(Number(str));
}