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.
95 lines
3.0 KiB
JavaScript
95 lines
3.0 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.Targets = void 0;
|
|
const util_1 = __importDefault(require("util"));
|
|
const base_1 = require("./base");
|
|
const delegations_1 = require("./delegations");
|
|
const file_1 = require("./file");
|
|
const utils_1 = require("./utils");
|
|
// Container for the signed part of targets metadata.
|
|
//
|
|
// Targets contains verifying information about target files and also delegates
|
|
// responsible to other Targets roles.
|
|
class Targets extends base_1.Signed {
|
|
type = base_1.MetadataKind.Targets;
|
|
targets;
|
|
delegations;
|
|
constructor(options) {
|
|
super(options);
|
|
this.targets = options.targets || {};
|
|
this.delegations = options.delegations;
|
|
}
|
|
addTarget(target) {
|
|
this.targets[target.path] = target;
|
|
}
|
|
equals(other) {
|
|
if (!(other instanceof Targets)) {
|
|
return false;
|
|
}
|
|
return (super.equals(other) &&
|
|
util_1.default.isDeepStrictEqual(this.targets, other.targets) &&
|
|
util_1.default.isDeepStrictEqual(this.delegations, other.delegations));
|
|
}
|
|
toJSON() {
|
|
const json = {
|
|
_type: this.type,
|
|
spec_version: this.specVersion,
|
|
version: this.version,
|
|
expires: this.expires,
|
|
targets: targetsToJSON(this.targets),
|
|
...this.unrecognizedFields,
|
|
};
|
|
if (this.delegations) {
|
|
json.delegations = this.delegations.toJSON();
|
|
}
|
|
return json;
|
|
}
|
|
static fromJSON(data) {
|
|
const { unrecognizedFields, ...commonFields } = base_1.Signed.commonFieldsFromJSON(data);
|
|
const { targets, delegations, ...rest } = unrecognizedFields;
|
|
return new Targets({
|
|
...commonFields,
|
|
targets: targetsFromJSON(targets),
|
|
delegations: delegationsFromJSON(delegations),
|
|
unrecognizedFields: rest,
|
|
});
|
|
}
|
|
}
|
|
exports.Targets = Targets;
|
|
function targetsToJSON(targets) {
|
|
return Object.entries(targets).reduce((acc, [path, target]) => ({
|
|
...acc,
|
|
[path]: target.toJSON(),
|
|
}), {});
|
|
}
|
|
function targetsFromJSON(data) {
|
|
let targets;
|
|
if (utils_1.guard.isDefined(data)) {
|
|
if (!utils_1.guard.isObjectRecord(data)) {
|
|
throw new TypeError('targets must be an object');
|
|
}
|
|
else {
|
|
targets = Object.entries(data).reduce((acc, [path, target]) => ({
|
|
...acc,
|
|
[path]: file_1.TargetFile.fromJSON(path, target),
|
|
}), {});
|
|
}
|
|
}
|
|
return targets;
|
|
}
|
|
function delegationsFromJSON(data) {
|
|
let delegations;
|
|
if (utils_1.guard.isDefined(data)) {
|
|
if (!utils_1.guard.isObject(data)) {
|
|
throw new TypeError('delegations must be an object');
|
|
}
|
|
else {
|
|
delegations = delegations_1.Delegations.fromJSON(data);
|
|
}
|
|
}
|
|
return delegations;
|
|
}
|