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.
69 lines
2.8 KiB
JavaScript
69 lines
2.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.formatLimitDefinition = void 0;
|
|
const ajv_1 = require("ajv");
|
|
const codegen_1 = require("ajv/dist/compile/codegen");
|
|
const ops = codegen_1.operators;
|
|
const KWDs = {
|
|
formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
|
|
formatMinimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT },
|
|
formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
|
|
formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE },
|
|
};
|
|
const error = {
|
|
message: ({ keyword, schemaCode }) => (0, codegen_1.str) `should be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`,
|
|
};
|
|
exports.formatLimitDefinition = {
|
|
keyword: Object.keys(KWDs),
|
|
type: "string",
|
|
schemaType: "string",
|
|
$data: true,
|
|
error,
|
|
code(cxt) {
|
|
const { gen, data, schemaCode, keyword, it } = cxt;
|
|
const { opts, self } = it;
|
|
if (!opts.validateFormats)
|
|
return;
|
|
const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format");
|
|
if (fCxt.$data)
|
|
validate$DataFormat();
|
|
else
|
|
validateFormat();
|
|
function validate$DataFormat() {
|
|
const fmts = gen.scopeValue("formats", {
|
|
ref: self.formats,
|
|
code: opts.code.formats,
|
|
});
|
|
const fmt = gen.const("fmt", (0, codegen_1._) `${fmts}[${fCxt.schemaCode}]`);
|
|
cxt.fail$data((0, codegen_1.or)((0, codegen_1._) `typeof ${fmt} != "object"`, (0, codegen_1._) `${fmt} instanceof RegExp`, (0, codegen_1._) `typeof ${fmt}.compare != "function"`, compareCode(fmt)));
|
|
}
|
|
function validateFormat() {
|
|
const format = fCxt.schema;
|
|
const fmtDef = self.formats[format];
|
|
if (!fmtDef || fmtDef === true)
|
|
return;
|
|
if (typeof fmtDef != "object" ||
|
|
fmtDef instanceof RegExp ||
|
|
typeof fmtDef.compare != "function") {
|
|
throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
|
|
}
|
|
const fmt = gen.scopeValue("formats", {
|
|
key: format,
|
|
ref: fmtDef,
|
|
code: opts.code.formats ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : undefined,
|
|
});
|
|
cxt.fail$data(compareCode(fmt));
|
|
}
|
|
function compareCode(fmt) {
|
|
return (0, codegen_1._) `${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
|
|
}
|
|
},
|
|
dependencies: ["format"],
|
|
};
|
|
const formatLimitPlugin = (ajv) => {
|
|
ajv.addKeyword(exports.formatLimitDefinition);
|
|
return ajv;
|
|
};
|
|
exports.default = formatLimitPlugin;
|
|
//# sourceMappingURL=limit.js.map
|