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.
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
'use strict'
|
|
|
|
const fs = require('graceful-fs')
|
|
const path = require('path')
|
|
const copySync = require('../copy').copySync
|
|
const removeSync = require('../remove').removeSync
|
|
const mkdirpSync = require('../mkdirs').mkdirpSync
|
|
const stat = require('../util/stat')
|
|
|
|
function moveSync (src, dest, opts) {
|
|
opts = opts || {}
|
|
const overwrite = opts.overwrite || opts.clobber || false
|
|
|
|
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
|
|
stat.checkParentPathsSync(src, srcStat, dest, 'move')
|
|
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
|
|
return doRename(src, dest, overwrite, isChangingCase)
|
|
}
|
|
|
|
function isParentRoot (dest) {
|
|
const parent = path.dirname(dest)
|
|
const parsedPath = path.parse(parent)
|
|
return parsedPath.root === parent
|
|
}
|
|
|
|
function doRename (src, dest, overwrite, isChangingCase) {
|
|
if (isChangingCase) return rename(src, dest, overwrite)
|
|
if (overwrite) {
|
|
removeSync(dest)
|
|
return rename(src, dest, overwrite)
|
|
}
|
|
if (fs.existsSync(dest)) throw new Error('dest already exists.')
|
|
return rename(src, dest, overwrite)
|
|
}
|
|
|
|
function rename (src, dest, overwrite) {
|
|
try {
|
|
fs.renameSync(src, dest)
|
|
} catch (err) {
|
|
if (err.code !== 'EXDEV') throw err
|
|
return moveAcrossDevice(src, dest, overwrite)
|
|
}
|
|
}
|
|
|
|
function moveAcrossDevice (src, dest, overwrite) {
|
|
const opts = {
|
|
overwrite,
|
|
errorOnExist: true,
|
|
preserveTimestamps: true
|
|
}
|
|
copySync(src, dest, opts)
|
|
return removeSync(src)
|
|
}
|
|
|
|
module.exports = moveSync
|