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.
91 lines
2.2 KiB
JavaScript
91 lines
2.2 KiB
JavaScript
const semver = require('semver')
|
|
const currentEnv = require('./current-env')
|
|
const { checkDevEngines } = require('./dev-engines')
|
|
|
|
const checkEngine = (target, npmVer, nodeVer, force = false) => {
|
|
const nodev = force ? null : nodeVer
|
|
const eng = target.engines
|
|
const opt = { includePrerelease: true }
|
|
if (!eng) {
|
|
return
|
|
}
|
|
|
|
const nodeFail = nodev && eng.node && !semver.satisfies(nodev, eng.node, opt)
|
|
const npmFail = npmVer && eng.npm && !semver.satisfies(npmVer, eng.npm, opt)
|
|
if (nodeFail || npmFail) {
|
|
throw Object.assign(new Error('Unsupported engine'), {
|
|
pkgid: target._id,
|
|
current: { node: nodeVer, npm: npmVer },
|
|
required: eng,
|
|
code: 'EBADENGINE',
|
|
})
|
|
}
|
|
}
|
|
|
|
const checkPlatform = (target, force = false, environment = {}) => {
|
|
if (force) {
|
|
return
|
|
}
|
|
|
|
const os = environment.os || currentEnv.os()
|
|
const cpu = environment.cpu || currentEnv.cpu()
|
|
const libc = environment.libc || currentEnv.libc(os)
|
|
|
|
const osOk = target.os ? checkList(os, target.os) : true
|
|
const cpuOk = target.cpu ? checkList(cpu, target.cpu) : true
|
|
let libcOk = target.libc ? checkList(libc, target.libc) : true
|
|
if (target.libc && !libc) {
|
|
libcOk = false
|
|
}
|
|
|
|
if (!osOk || !cpuOk || !libcOk) {
|
|
throw Object.assign(new Error('Unsupported platform'), {
|
|
pkgid: target._id,
|
|
current: {
|
|
os,
|
|
cpu,
|
|
libc,
|
|
},
|
|
required: {
|
|
os: target.os,
|
|
cpu: target.cpu,
|
|
libc: target.libc,
|
|
},
|
|
code: 'EBADPLATFORM',
|
|
})
|
|
}
|
|
}
|
|
|
|
const checkList = (value, list) => {
|
|
if (typeof list === 'string') {
|
|
list = [list]
|
|
}
|
|
if (list.length === 1 && list[0] === 'any') {
|
|
return true
|
|
}
|
|
// match none of the negated values, and at least one of the
|
|
// non-negated values, if any are present.
|
|
let negated = 0
|
|
let match = false
|
|
for (const entry of list) {
|
|
const negate = entry.charAt(0) === '!'
|
|
const test = negate ? entry.slice(1) : entry
|
|
if (negate) {
|
|
negated++
|
|
if (value === test) {
|
|
return false
|
|
}
|
|
} else {
|
|
match = match || value === test
|
|
}
|
|
}
|
|
return match || negated === list.length
|
|
}
|
|
|
|
module.exports = {
|
|
checkEngine,
|
|
checkPlatform,
|
|
checkDevEngines,
|
|
currentEnv,
|
|
}
|