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.
93 lines
2.5 KiB
JavaScript
93 lines
2.5 KiB
JavaScript
'use strict'
|
|
|
|
const u = require('universalify').fromPromise
|
|
const path = require('path')
|
|
const fs = require('../fs')
|
|
|
|
const { mkdirs, mkdirsSync } = require('../mkdirs')
|
|
|
|
const { symlinkPaths, symlinkPathsSync } = require('./symlink-paths')
|
|
const { symlinkType, symlinkTypeSync } = require('./symlink-type')
|
|
|
|
const { pathExists } = require('../path-exists')
|
|
|
|
const { areIdentical } = require('../util/stat')
|
|
|
|
async function createSymlink (srcpath, dstpath, type) {
|
|
let stats
|
|
try {
|
|
stats = await fs.lstat(dstpath)
|
|
} catch { }
|
|
|
|
if (stats && stats.isSymbolicLink()) {
|
|
// When srcpath is relative, resolve it relative to dstpath's directory
|
|
// (standard symlink behavior) or fall back to cwd if that doesn't exist
|
|
let srcStat
|
|
if (path.isAbsolute(srcpath)) {
|
|
srcStat = await fs.stat(srcpath)
|
|
} else {
|
|
const dstdir = path.dirname(dstpath)
|
|
const relativeToDst = path.join(dstdir, srcpath)
|
|
try {
|
|
srcStat = await fs.stat(relativeToDst)
|
|
} catch {
|
|
srcStat = await fs.stat(srcpath)
|
|
}
|
|
}
|
|
|
|
const dstStat = await fs.stat(dstpath)
|
|
if (areIdentical(srcStat, dstStat)) return
|
|
}
|
|
|
|
const relative = await symlinkPaths(srcpath, dstpath)
|
|
srcpath = relative.toDst
|
|
const toType = await symlinkType(relative.toCwd, type)
|
|
const dir = path.dirname(dstpath)
|
|
|
|
if (!(await pathExists(dir))) {
|
|
await mkdirs(dir)
|
|
}
|
|
|
|
return fs.symlink(srcpath, dstpath, toType)
|
|
}
|
|
|
|
function createSymlinkSync (srcpath, dstpath, type) {
|
|
let stats
|
|
try {
|
|
stats = fs.lstatSync(dstpath)
|
|
} catch { }
|
|
if (stats && stats.isSymbolicLink()) {
|
|
// When srcpath is relative, resolve it relative to dstpath's directory
|
|
// (standard symlink behavior) or fall back to cwd if that doesn't exist
|
|
let srcStat
|
|
if (path.isAbsolute(srcpath)) {
|
|
srcStat = fs.statSync(srcpath)
|
|
} else {
|
|
const dstdir = path.dirname(dstpath)
|
|
const relativeToDst = path.join(dstdir, srcpath)
|
|
try {
|
|
srcStat = fs.statSync(relativeToDst)
|
|
} catch {
|
|
srcStat = fs.statSync(srcpath)
|
|
}
|
|
}
|
|
|
|
const dstStat = fs.statSync(dstpath)
|
|
if (areIdentical(srcStat, dstStat)) return
|
|
}
|
|
|
|
const relative = symlinkPathsSync(srcpath, dstpath)
|
|
srcpath = relative.toDst
|
|
type = symlinkTypeSync(relative.toCwd, type)
|
|
const dir = path.dirname(dstpath)
|
|
const exists = fs.existsSync(dir)
|
|
if (exists) return fs.symlinkSync(srcpath, dstpath, type)
|
|
mkdirsSync(dir)
|
|
return fs.symlinkSync(srcpath, dstpath, type)
|
|
}
|
|
|
|
module.exports = {
|
|
createSymlink: u(createSymlink),
|
|
createSymlinkSync
|
|
}
|