How to use as method in Cypress

Best JavaScript code snippet using cypress

server.js

Source:server.js Github

copy

Full Screen

1var express = require('express')2var app = express()3var http = require('http')4app.use(express.static(__dirname + '/Web_design'));5var bookingnumber = 10006var bodyParser = require('body-parser')7app.use(bodyParser.urlencoded({ extended: true }))8var pg = require('pg')9var conString = "postgres://postgres:postgres@localhost:5432/AirCobra"10var client = new pg.Client(conString)11var email = ''12var price = 10000013var duration = '150:00:00'14var airline = ''15var flight = ''16var cl = ''17var size = ''18//EXPRESS JAVASCRIPT19app.set('view engine', 'ejs');20//GET21app.get('/', function(req, response) {22 response.sendFile('Web_design/i.html', {root: __dirname });23});24app.get('/sign_up.html', function(req, response){25 response.sendFile('Web_design/sign_up.html', {root: __dirname });26})27app.get('/wsign_up.html', function(req, response){28 response.sendFile('Web_design/wsign_up.html', {root: __dirname });29})30app.get('/login.html', function(req, response){31 response.sendFile('Web_design/login.html', {root: __dirname });32})33app.get('/wlogin.html', function(req, response){34 response.sendFile('Web_design/wlogin.html', {root: __dirname });35})36app.get('/booking.html', function(req, response){37 response.sendFile('Web_design/booking.html', {root: __dirname });38})39app.get('/ebooking.html', function(req, response){40 response.sendFile('Web_design/ebooking.html', {root: __dirname });41})42app.get('/abooking.html', function(req, response){43 response.sendFile('Web_design/abooking.html', {root: __dirname });44})45app.get('/wbooking.html', function(req, response){46 response.sendFile('Web_design/wbooking.html', {root: __dirname });47})48app.get('/i.html', function(req, response){49 response.sendFile('Web_design/i.html', {root: __dirname });50})51app.get('/admin', function(req, response){52 var customer = []53 var creditcard = []54 var flight = []55 var airline = []56 var airport = []57 var price = []58 var booking = []59 var values = []60 var text1 = "SELECT * FROM customer"61 var text2 = "SELECT * FROM creditcard"62 var text3 = "SELECT * FROM flight"63 var text4 = "SELECT * FROM airport"64 var text5 = "SELECT * FROM airline"65 var text6 = "SELECT * FROM booking"66 var text7 = "SELECT * FROM price"67 pg.connect(conString, function (err, client, done) {68 if (err) {69 return console.error('could not connect to postgres', err)70 } 71 client.query(text1, values, (err, res) => {72 if (err) {73 console.log (err.stack)74 done75 response.sendFile('Web_design/abooking.html', {root: __dirname })76 } else{77 console.log(res.rows[0])78 for(i = 0; i < res.rows.length; i++){79 customer.push({80 fn : res.rows[i].firstname,81 ln : res.rows[i].lastname,82 em : res.rows[i].email,83 ad : res.rows[i].address,84 hi : res.rows[i].hiata,85 })86 }87 }88 })89 client.query(text2, values, (err, res) => {90 if (err) {91 console.log (err.stack)92 done93 response.sendFile('Web_design/abooking.html', {root: __dirname })94 } else{95 console.log(res.rows[0])96 for(i = 0; i < res.rows.length; i++){97 creditcard.push({98 cn : res.rows[i].creditcardnumber,99 pa : res.rows[i].paymentaddress,100 em : res.rows[i].email,101 })102 }103 }104 })105 client.query(text3, values, (err, res) => {106 if (err) {107 console.log (err.stack)108 done109 response.sendFile('Web_design/abooking.html', {root: __dirname })110 } else{111 console.log(res.rows[0])112 for(i = 0; i < res.rows.length; i++){113 flight.push({114 ac : res.rows[i].airlinecode,115 fn : res.rows[i].flightnumber,116 ia : res.rows[i].iata,117 dt : res.rows[i].date,118 di : res.rows[i].diata,119 ddt : res.rows[i].ddate,120 fs : res.rows[i].fseat,121 es : res.rows[i].eseat122 })123 }124 }125 })126 client.query(text4, values, (err, res) => {127 if (err) {128 console.log (err.stack)129 done130 response.sendFile('Web_design/abooking.html', {root: __dirname })131 } else{132 console.log(res.rows[0])133 for(i = 0; i < res.rows.length; i++){134 airport.push({135 co : res.rows[i].country,136 ia : res.rows[i].iata,137 st : res.rows[i].state,138 ap : res.rows[i].apname139 })140 }141 }142 })143 client.query(text5, values, (err, res) => {144 if (err) {145 console.log (err.stack)146 done147 response.sendFile('Web_design/abooking.html', {root: __dirname })148 } else{149 console.log(res.rows[0])150 for(i = 0; i < res.rows.length; i++){151 airline.push({152 ai : res.rows[i].airlinecode,153 ia : res.rows[i].iata,154 fn : res.rows[i].fullname,155 co : res.rows[i].country_of_origin156 })157 }158 }159 })160 client.query(text6, values, (err, res) => {161 if (err) {162 console.log (err.stack)163 done164 response.sendFile('Web_design/abooking.html', {root: __dirname })165 } else{166 console.log(res.rows[0])167 for(i = 0; i < res.rows.length; i++){168 booking.push({169 bo : res.rows[i].bookingnumber,170 fl : res.rows[i].flightnumber,171 ai : res.rows[i].airlinecode,172 cn : res.rows[i].creditcardnumber,173 se : res.rows[i].seatclass,174 em : res.rows[i].email175 })176 }177 }178 })179 client.query(text7, values, (err, res) => {180 if (err) {181 console.log (err.stack)182 done183 response.sendFile('Web_design/abooking.html', {root: __dirname })184 } else{185 console.log(res.rows[0])186 for(i = 0; i < res.rows.length; i++){187 price.push({188 ac : res.rows[i].airlinecode,189 fn : res.rows[i].flightnumber,190 fp : res.rows[i].firstclassprice,191 ep : res.rows[i].economyclassprice192 })193 }194 done195 response.render('pages/admin',{cust : customer,196 book : booking,197 cred : creditcard,198 price : price,199 airl : airline,200 airp : airport,201 flight : flight })202 }203 })204 })205})206app.get('/manage', function(req, response){207 pg.connect(conString, function (err, client, done) {208 if (err) {209 return console.error('could not connect to postgres', err)210 } 211 const text4 = 'SELECT booking.bookingnumber as b,booking.flightnumber as f,booking.airlinecode as a,booking.creditcardnumber as c,booking.seatclass as s FROM booking WHERE email = $1'212 const values4 = [email]213 client.query(text4, values4, (err, res) => {214 if (err) {215 console.log (err.stack)216 response.sendFile('Web_design/abooking.html', {root: __dirname })217 done218 } else{219 console.log(res.rows[0])220 var result = []221 for(i = 0; i < res.rows.length; i++){222 result.push({223 bn : res.rows[i].b,224 fl : res.rows[i].f,225 ac : res.rows[i].a,226 cn : res.rows[i].c,227 se : res.rows[i].s,228 })229 }230 console.log(result)231 response.render('pages/manage',{drinks : result})232 }233 })234 })235})236app.get('/update', function(req, response){237 pg.connect(conString, function (err, client, done) {238 if (err) {239 return console.error('could not connect to postgres', err)240 } 241 var text4 = 'SELECT customer.firstname as f,customer.lastname as l,customer.address as a,customer.hiata as h FROM customer where email = $1'242 var values4 = [email]243 var result2 = []244 var result = []245 var text = 'SELECT (creditcard.creditcardnumber) as cn, (creditcard.paymentaddress) as add FROM creditcard WHERE email = $1'246 client.query(text4, values4, (err, res) => {247 if (err) {248 console.log (err.stack)249 response.sendFile('Web_design/wbooking.html', {root: __dirname })250 done251 } else{252 console.log(res.rows[0])253 for(i = 0; i < res.rows.length; i++){254 result.push({255 fn : res.rows[i].f,256 ln : res.rows[i].l,257 hi : res.rows[i].h,258 em : email,259 ad : res.rows[i].a,260 })261 }262 console.log(result)263 }264 })265 client.query(text, values4, (err, res) => {266 if (err) {267 console.log (err.stack)268 response.sendFile('Web_design/wbooking.html', {root: __dirname })269 done270 } else{271 console.log(res.rows[0])272 for(i = 0; i < res.rows.length; i++){273 result2.push({274 cnumber : res.rows[i].cn,275 pa : res.rows[i].add276 })277 }278 console.log(result)279 response.render('pages/update',{drinks : result, 280 drinks2 : result2})281 }282 })283 })284})285//POST286app.post('/login', function(req, response) {287 pg.connect(conString, function (err, client, done) {288 if (err) {289 return console.error('could not connect to postgres', err)290 } 291 var credit = parseInt(req.body.credit);292 const tex = 'SELECT FROM customer WHERE email = $1 AND firstname = $2'293 const value = [req.body.email,req.body.fname]294 client.query(tex, value, (err, res) => {295 if (err) {296 console.log (err.stack)297 done298 response.sendFile('Web_design/login.html', {root: __dirname })299 } else{300 console.log(res.rows[0])301 done302 if (typeof(res.rows[0]) != "undefined"){303 email = req.body.email304 response.sendFile('Web_design/booking.html', {root: __dirname })305 }306 else{307 response.sendFile('Web_design/wlogin.html', {root: __dirname })308 }309 }310 })311 })312})313app.post('/myaction', function(req, response) {314 pg.connect(conString, function (err, client, done) {315 if (err) {316 return console.error('could not connect to postgres', err)317 } 318 var credit = parseInt(req.body.credit);319 const tex = 'INSERT INTO customer (firstname,lastname,email,address,hiata) VALUES($1, $2, $3, $4, $5) RETURNING *'320 const value = [req.body.fname,req.body.lname,req.body.email,req.body.add,req.body.hiata]321 email = req.body.email322 client.query(tex, value, (err, res) => {323 if (err) {324 console.log (err.stack)325 done326 response.sendFile('Web_design/wsign_up.html', {root: __dirname })327 } else{328 console.log(res.rows[0])329 done330 if (typeof(res.rows[0]) != "undefined"){331 email = req.body.email332 response.sendFile('Web_design/booking.html', {root: __dirname })333 }334 else{335 response.sendFile('Web_design/wsign_up.html', {root: __dirname })336 }337 }338 })339 })340})341app.post('/updateInfo', function(req, response) {342 pg.connect(conString, function (err, client, done) {343 if (err) {344 return console.error('could not connect to postgres', err)345 } 346 const text = "UPDATE customer SET firstname = $1, lastname = $2, address = $3, email = $4, hiata = $5 WHERE email = $6 RETURNING *"347 const values = [req.body.fname,req.body.lname,req.body.add,req.body.email,req.body.hiata,email]348 client.query(text, values, (err, res) => {349 if (err) {350 console.log (err.stack)351 done352 response.sendFile('Web_design/wbooking.html', {root: __dirname })353 } else{354 console.log(res.rows[0])355 done356 if (typeof(res.rows[0]) != "undefined"){357 email = req.body.email358 response.sendFile('Web_design/abooking.html', {root: __dirname })359 }360 else{361 response.sendFile('Web_design/wbooking.html', {root: __dirname })362 } 363 }364 })365 })366})367 368app.post('/deleteCredit', function(req, response) {369 pg.connect(conString, function (err, client, done) {370 if (err) {371 return console.error('could not connect to postgres', err)372 } 373 var credit = parseInt(req.body.credit)374 const text5 = 'DELETE FROM creditcard WHERE email = $3 AND (creditcardnumber = $1 OR paymentaddress = $2) RETURNING *'375 const values5 = [credit,req.body.dbadd,email]376 client.query(text5, values5, (err, res) => {377 if (err) {378 console.log (err.stack)379 done380 response.sendFile('Web_design/wbooking.html', {root: __dirname })381 } else{382 console.log(res.rows[0])383 done384 }385 })386 response.sendFile('Web_design/abooking.html', {root: __dirname })387 })388})389app.post('/addCredit', function(req, response) {390 pg.connect(conString, function (err, client, done) {391 if (err) {392 return console.error('could not connect to postgres', err)393 } 394 var credit = parseInt(req.body.credit)395 const text4 = 'INSERT INTO creditcard (email,creditcardnumber,paymentaddress) VALUES($1, $2, $3) RETURNING *'396 const values4 = [email,credit,req.body.badd]397 client.query(text4, values4, (err, res) => {398 if (err) {399 console.log (err.stack)400 done401 response.sendFile('Web_design/wbooking.html', {root: __dirname })402 } else{403 console.log(res.rows[0])404 done405 }406 })407 response.sendFile('Web_design/abooking.html', {root: __dirname })408 })409})410app.post('/book0', function(req, response){411 var temp2 = req.body.ac412 var temp = temp2.split('.')413 airline = temp[1].toString()414 flight = temp[0].toString()415 temp3 = airline.split(',')416 temp4 = flight.split(',')417 size = req.body.c418 if(req.body.cl == 'First')419 cl = 'First'420 else421 cl = 'Economy'422 var result = []423 pg.connect(conString, function (err, client, done) {424 if (err) {425 return console.error('could not connect to postgres', err)426 } 427 var credit = parseInt(req.body.credit)428 var tex = 'SELECT (creditcard.creditcardnumber) as a FROM creditcard WHERE email = $1'429 var values4 = [email]430 client.query(tex, values4, (err, res) => {431 if (err) {432 console.log (err.stack)433 done434 response.sendFile('Web_design/wbooking.html', {root: __dirname })435 } else{436 for(i = 0; i < res.rows.length; i++){437 result.push({438 cnumber : res.rows[i].a439 })440 }441 var flights = []442 for(j = 0;j < temp3.length;j++){443 flights.push({444 ac : temp3[j],445 fn : temp4[j]446 })447 }448 console.log(result)449 response.render('pages/purchase',{drinks : result,450 fly : flights, 451 cl: cl})452 }453 })454 })455})456app.post('/bookc', function(req, response){457 var text = []458 var text2 = []459 var value = []460 var nairline = airline.split(',')461 var nflight = flight.split(',')462 var seat = 'eseat'463 if(cl == 'First')464 seat = 'fseat'465 pg.connect(conString, function (err, client, done) {466 if (err) {467 return console.error('could not connect to postgres', err)468 } 469 for(var i = 0; i < nairline.length; i++){470 text.push('UPDATE flight SET '+seat+' = '+seat+' - 1 WHERE (airlinecode = \''+nairline[0]+'\' AND flightnumber = '+parseInt(nflight[0])+')')471 text2.push('INSERT INTO booking (bookingnumber,flightnumber,airlinecode,creditcardnumber,seatclass,email) VALUES('+bookingnumber+','+parseInt(nflight[i])+',\''+nairline[i]+'\','+parseInt(req.body.ac)+',\''+cl+'\',\''+email+'\')')472 console.log(text[i])473 console.log(text2[i])474 }475 if(nairline.length == 1){476 client.query(text[0], value, (err, res) => {477 if (err) {478 console.log (err.stack)479 done480 response.sendFile('Web_design/wbooking.html', {root: __dirname })481 } 482 console.log('yay')483 done484 })485 client.query(text2[0], value, (err, res) => {486 if (err) {487 console.log (err.stack)488 done489 response.sendFile('Web_design/wbooking.html', {root: __dirname })490 } else{491 done492 bookingnumber++493 response.sendFile('Web_design/abooking.html', {root: __dirname })494 }495 })496 }497 if(nairline.length == 2){498 client.query(text[1], value, (err, res) => {499 if (err) {500 console.log (err.stack)501 done502 response.sendFile('Web_design/wbooking.html', {root: __dirname })503 } 504 console.log('yay')505 done506 })507 client.query(text2[1], value, (err, res) => {508 if (err) {509 console.log (err.stack)510 done511 response.sendFile('Web_design/wbooking.html', {root: __dirname })512 } else{513 done514 }515 })516 client.query(text[0], value, (err, res) => {517 if (err) {518 console.log (err.stack)519 done520 response.sendFile('Web_design/wbooking.html', {root: __dirname })521 } 522 console.log('yay')523 done524 })525 client.query(text2[0], value, (err, res) => {526 if (err) {527 console.log (err.stack)528 done529 response.sendFile('Web_design/wbooking.html', {root: __dirname })530 } else{531 done532 bookingnumber++533 response.sendFile('Web_design/abooking.html', {root: __dirname })534 }535 })536 }537 if(nairline.length == 3){538 client.query(text[2], value, (err, res) => {539 if (err) {540 console.log (err.stack)541 done542 response.sendFile('Web_design/wbooking.html', {root: __dirname })543 } 544 console.log('yay')545 done546 })547 client.query(text2[2], value, (err, res) => {548 if (err) {549 console.log (err.stack)550 done551 response.sendFile('Web_design/wbooking.html', {root: __dirname })552 } else{553 done554 }555 })556 client.query(text[1], value, (err, res) => {557 if (err) {558 console.log (err.stack)559 done560 response.sendFile('Web_design/wbooking.html', {root: __dirname })561 } 562 console.log('yay')563 done564 })565 client.query(text2[1], value, (err, res) => {566 if (err) {567 console.log (err.stack)568 done569 response.sendFile('Web_design/wbooking.html', {root: __dirname })570 } else{571 done572 }573 })574 client.query(text[0], value, (err, res) => {575 if (err) {576 console.log (err.stack)577 done578 response.sendFile('Web_design/wbooking.html', {root: __dirname })579 } 580 console.log('yay')581 done582 })583 client.query(text2[0], value, (err, res) => {584 if (err) {585 console.log (err.stack)586 done587 response.sendFile('Web_design/wbooking.html', {root: __dirname })588 } else{589 done590 bookingnumber++591 response.sendFile('Web_design/abooking.html', {root: __dirname })592 }593 })594 }595 if(nairline.length == 4){596 client.query(text[3], value, (err, res) => {597 if (err) {598 console.log (err.stack)599 done600 response.sendFile('Web_design/wbooking.html', {root: __dirname })601 } 602 console.log('yay')603 done604 })605 client.query(text2[3], value, (err, res) => {606 if (err) {607 console.log (err.stack)608 done609 response.sendFile('Web_design/wbooking.html', {root: __dirname })610 } else{611 done612 }613 })614 client.query(text[2], value, (err, res) => {615 if (err) {616 console.log (err.stack)617 done618 response.sendFile('Web_design/wbooking.html', {root: __dirname })619 } 620 console.log('yay')621 done622 })623 client.query(text2[2], value, (err, res) => {624 if (err) {625 console.log (err.stack)626 done627 response.sendFile('Web_design/wbooking.html', {root: __dirname })628 } else{629 done630 }631 })632 client.query(text[1], value, (err, res) => {633 if (err) {634 console.log (err.stack)635 done636 response.sendFile('Web_design/wbooking.html', {root: __dirname })637 } 638 console.log('yay')639 done640 })641 client.query(text2[1], value, (err, res) => {642 if (err) {643 console.log (err.stack)644 done645 response.sendFile('Web_design/wbooking.html', {root: __dirname })646 } else{647 done648 }649 })650 client.query(text[0], value, (err, res) => {651 if (err) {652 console.log (err.stack)653 done654 response.sendFile('Web_design/wbooking.html', {root: __dirname })655 } 656 console.log('yay')657 done658 })659 client.query(text2[0], value, (err, res) => {660 if (err) {661 console.log (err.stack)662 done663 response.sendFile('Web_design/wbooking.html', {root: __dirname })664 } else{665 done666 bookingnumber++667 response.sendFile('Web_design/abooking.html', {root: __dirname })668 }669 })670 }671 if(nairline.length == 6){672 client.query(text[5], value, (err, res) => {673 if (err) {674 console.log (err.stack)675 done676 response.sendFile('Web_design/wbooking.html', {root: __dirname })677 } 678 console.log('yay')679 done680 })681 client.query(text2[5], value, (err, res) => {682 if (err) {683 console.log (err.stack)684 done685 response.sendFile('Web_design/wbooking.html', {root: __dirname })686 } else{687 done688 }689 })690 client.query(text[4], value, (err, res) => {691 if (err) {692 console.log (err.stack)693 done694 response.sendFile('Web_design/wbooking.html', {root: __dirname })695 } 696 console.log('yay')697 done698 })699 client.query(text2[4], value, (err, res) => {700 if (err) {701 console.log (err.stack)702 done703 response.sendFile('Web_design/wbooking.html', {root: __dirname })704 } else{705 done706 }707 })708 client.query(text[3], value, (err, res) => {709 if (err) {710 console.log (err.stack)711 done712 response.sendFile('Web_design/wbooking.html', {root: __dirname })713 } 714 console.log('yay')715 done716 })717 client.query(text2[3], value, (err, res) => {718 if (err) {719 console.log (err.stack)720 done721 response.sendFile('Web_design/wbooking.html', {root: __dirname })722 } else{723 done724 }725 })726 client.query(text[2], value, (err, res) => {727 if (err) {728 console.log (err.stack)729 done730 response.sendFile('Web_design/wbooking.html', {root: __dirname })731 } 732 console.log('yay')733 done734 })735 client.query(text2[2], value, (err, res) => {736 if (err) {737 console.log (err.stack)738 done739 response.sendFile('Web_design/wbooking.html', {root: __dirname })740 } else{741 done742 }743 })744 client.query(text[1], value, (err, res) => {745 if (err) {746 console.log (err.stack)747 done748 response.sendFile('Web_design/wbooking.html', {root: __dirname })749 } 750 console.log('yay')751 done752 })753 client.query(text2[1], value, (err, res) => {754 if (err) {755 console.log (err.stack)756 done757 response.sendFile('Web_design/wbooking.html', {root: __dirname })758 } else{759 done760 }761 })762 client.query(text[0], value, (err, res) => {763 if (err) {764 console.log (err.stack)765 done766 response.sendFile('Web_design/wbooking.html', {root: __dirname })767 } 768 console.log('yay')769 done770 })771 client.query(text2[0], value, (err, res) => {772 if (err) {773 console.log (err.stack)774 done775 response.sendFile('Web_design/wbooking.html', {root: __dirname })776 } else{777 done778 bookingnumber++779 response.sendFile('Web_design/abooking.html', {root: __dirname })780 }781 })782 }783 })784})785app.post('/deletebooking', function(req, response) {786 var temp = ((req.body.bn).toString()).split(',')787 var seat = 'eseat'788 if(temp[3]=='First')789 seat = 'fseat'790 pg.connect(conString, function (err, client, done) {791 if (err) {792 return console.error('could not connect to postgres', err)793 }794 var credit = parseInt(req.body.credit)795 const text5 = 'DELETE FROM booking WHERE email = $1 AND bookingnumber = $2'796 const values5 = [email,parseInt(temp[0])]797 var text = 'UPDATE FLIGHT SET '+seat+' = '+seat+' + 1 WHERE flightnumber = '+parseInt(temp[2])+' AND airlinecode = \''+temp[1]+'\''798 var value = []799 client.query(text5, values5, (err, res) => {800 if (err) {801 console.log (err.stack)802 done803 response.sendFile('Web_design/wbooking.html', {root: __dirname })804 } else{805 console.log(res.rows[0])806 done807 }808 })809 client.query(text, value, (err, res) => {810 if (err) {811 console.log (err.stack)812 done813 response.sendFile('Web_design/wbooking.html', {root: __dirname })814 } else{815 console.log(res.rows[0])816 done817 response.sendFile('Web_design/abooking.html', {root: __dirname })818 }819 })820 })821})822app.post('/booking', function(req, response) {823 var days = 0824 var hours = 0825 var minutes = 0826 var test = 'Economy Class'827 if(req.body.price == "First"){828 test = 'First Class'829 }830 if(req.body.dep != "Preferred Price")831 price = parseFloat(req.body.dep)832 if(req.body.dur != "Time Limit (hours)")833 duration = req.body.dur+':00:00'834 if(req.body.conn == '2'){835 pg.connect(conString, function (err, client, done) { // 2 connections COMEBACK836 if (err) {837 return console.error('could not connect to postgres', err)838 response.sendFile('Web_design/booking.html', {root: __dirname })839 } 840 var tex = ''841 var value = []842 if(req.body.check == "Search Round Trip Flights"){843 var value = [req.body.ddate,req.body.adate,req.body.iata,req.body.diata,req.body.ddate+' 24:00:00',req.body.adate+ ' 24:00:00',price,duration]844 if(req.body.order == "Flight Length"){845 if(req.body.price == "First")846 var tex = 'select a3.firstclassprice + a2.firstclassprice + a1.firstclassprice + a4.firstclassprice + a5.firstclassprice + a6.firstclassprice as tprice, ((a6.ddate - a4.date) + (a3.ddate - a1.date)) as duration, a4.iata as a4i, a5.iata as a5i, a6.iata as a6i, a1.iata as a1i,a2.iata as a2i,a3.iata as a3i, a4.diata as a4d, a5.diata as a5d, a6.diata as a6d, a1.diata as a1d,a2.diata as a2d,a3.diata as a3d,a1.firstclassprice as a1p,a2.firstclassprice as a2p,a3.firstclassprice as a3p,a4.firstclassprice as a4p,a6.firstclassprice as a6p,a5.firstclassprice as a5p, a1.fseat as a1s,a2.fseat as a2s,a3.fseat as a3s,a1.airlinecode as a1a,a2.airlinecode as a2a,a3.airlinecode as a3a,a4.fseat as a4s,a5.fseat as a5s,a6.fseat as a6s,a4.airlinecode as a4a,a5.airlinecode as a5a,a6.airlinecode as a6a, a3.flightnumber as a3f, a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a3.date as a3dt, a4.flightnumber as a4f, a5.flightnumber as a5f,a6.flightnumber as a6f,a4.date as a4dt,a5.date as a5dt,a6.date as a6dt, a3.ddate as a3ddt, a1.ddate as a1ddt,a2.ddate as a2ddt, a4.ddate as a4ddt, a5.ddate as a5ddt,a6.ddate as a6ddt from ((flight natural Join price) as a1 join (flight natural Join price) as a2 on a1.diata = a2.iata join (flight natural Join price) as a3 on a2.diata = a3.iata) cross join ((flight natural Join price) as a4 join (flight natural Join price) as a5 on a4.diata = a5.iata join (flight natural Join price) as a6 on a5.diata = a6.iata) where (a1.iata = $3 and (a3.firstclassprice + a2.firstclassprice + a1.firstclassprice + a4.firstclassprice + a5.firstclassprice + a6.firstclassprice) < $7 AND (a3.ddate - a1.date) < $8 and a3.diata = $4 and a1.fseat > 0 and a2.fseat > 0 and a3.fseat > 0 and a1.ddate <= a2.date and a2.ddate <= a3.date and a1.date >= $1 and a1.date < $5) AND (a4.iata = $4 AND a6.diata = $3 and a4.ddate <= a5.date and a4.fseat > 0 and a5.fseat > 0 and a6.fseat > 0 and a5.ddate <= a6.date and a4.date >= $2 and a4.date < $6) ORDER BY ((a6.ddate - a4.date) + (a3.ddate - a1.date)) asc'847 else848 var tex = 'select a3.economyclassprice + a2.economyclassprice + a1.economyclassprice + a4.economyclassprice + a5.economyclassprice + a6.economyclassprice as tprice, ((a6.ddate - a4.date) + (a3.ddate - a1.date)) as duration, a4.iata as a4i, a5.iata as a5i, a6.iata as a6i, a1.iata as a1i,a2.iata as a2i,a3.iata as a3i, a4.diata as a4d, a5.diata as a5d, a6.diata as a6d, a1.diata as a1d,a2.diata as a2d,a3.diata as a3d,a1.economyclassprice as a1p,a2.economyclassprice as a2p,a3.economyclassprice as a3p,a4.economyclassprice as a4p,a6.economyclassprice as a6p,a5.economyclassprice as a5p, a1.eseat as a1s,a2.eseat as a2s,a3.eseat as a3s,a1.airlinecode as a1a,a2.airlinecode as a2a,a3.airlinecode as a3a,a4.eseat as a4s,a5.eseat as a5s,a6.eseat as a6s,a4.airlinecode as a4a,a5.airlinecode as a5a,a6.airlinecode as a6a, a3.flightnumber as a3f, a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a3.date as a3dt, a4.flightnumber as a4f, a5.flightnumber as a5f,a6.flightnumber as a6f,a4.date as a4dt,a5.date as a5dt,a6.date as a6dt, a3.ddate as a3ddt, a1.ddate as a1ddt,a2.ddate as a2ddt, a4.ddate as a4ddt, a5.ddate as a5ddt,a6.ddate as a6ddt from ((flight natural Join price) as a1 join (flight natural Join price) as a2 on a1.diata = a2.iata join (flight natural Join price) as a3 on a2.diata = a3.iata) cross join ((flight natural Join price) as a4 join (flight natural Join price) as a5 on a4.diata = a5.iata join (flight natural Join price) as a6 on a5.diata = a6.iata) where (a1.iata = $3 and (a3.economyclassprice + a2.economyclassprice + a1.economyclassprice + a4.economyclassprice + a5.economyclassprice + a6.economyclassprice) < $7 AND (a3.ddate - a1.date) < $8 and a3.diata = $4 and a1.eseat > 0 and a2.eseat > 0 and a3.eseat > 0 and a1.ddate <= a2.date and a2.ddate <= a3.date and a1.date >= $1 and a1.date < $5) AND (a4.iata = $4 AND a6.diata = $3 and a4.ddate <= a5.date and a4.eseat > 0 and a5.eseat > 0 and a6.eseat > 0 and a5.ddate <= a6.date and a4.date >= $2 and a4.date < $6) ORDER BY ((a6.ddate - a4.date) + (a3.ddate - a1.date)) asc'849 }850 else{851 if(req.body.price == "First")852 var tex = 'select a3.firstclassprice + a2.firstclassprice + a1.firstclassprice + a4.firstclassprice + a5.firstclassprice + a6.firstclassprice as tprice, ((a6.ddate - a4.date) + (a3.ddate - a1.date)) as duration, a4.iata as a4i, a5.iata as a5i, a6.iata as a6i, a1.iata as a1i,a2.iata as a2i,a3.iata as a3i, a4.diata as a4d, a5.diata as a5d, a6.diata as a6d, a1.diata as a1d,a2.diata as a2d,a3.diata as a3d,a1.firstclassprice as a1p,a2.firstclassprice as a2p,a3.firstclassprice as a3p,a4.firstclassprice as a4p,a6.firstclassprice as a6p,a5.firstclassprice as a5p, a1.fseat as a1s,a2.fseat as a2s,a3.fseat as a3s,a1.airlinecode as a1a,a2.airlinecode as a2a,a3.airlinecode as a3a,a4.fseat as a4s,a5.fseat as a5s,a6.fseat as a6s,a4.airlinecode as a4a,a5.airlinecode as a5a,a6.airlinecode as a6a, a3.flightnumber as a3f, a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a3.date as a3dt, a4.flightnumber as a4f, a5.flightnumber as a5f,a6.flightnumber as a6f,a4.date as a4dt,a5.date as a5dt,a6.date as a6dt, a3.ddate as a3ddt, a1.ddate as a1ddt,a2.ddate as a2ddt, a4.ddate as a4ddt, a5.ddate as a5ddt,a6.ddate as a6ddt from ((flight natural Join price) as a1 join (flight natural Join price) as a2 on a1.diata = a2.iata join (flight natural Join price) as a3 on a2.diata = a3.iata) cross join ((flight natural Join price) as a4 join (flight natural Join price) as a5 on a4.diata = a5.iata join (flight natural Join price) as a6 on a5.diata = a6.iata) where (a1.iata = $3 and (a3.firstclassprice + a2.firstclassprice + a1.firstclassprice + a4.firstclassprice + a5.firstclassprice + a6.firstclassprice) < $7 AND (a3.ddate - a1.date) < $8 and a3.diata = $4 and a1.fseat > 0 and a2.fseat > 0 and a3.fseat > 0 and a1.ddate <= a2.date and a2.ddate <= a3.date and a1.date >= $1 and a1.date < $5) AND (a4.iata = $4 AND a6.diata = $3 and a4.ddate <= a5.date and a4.fseat > 0 and a5.fseat > 0 and a6.fseat > 0 and a5.ddate <= a6.date and a4.date >= $2 and a4.date < $6) ORDER BY (a3.firstclassprice + a2.firstclassprice + a1.firstclassprice + a4.firstclassprice + a5.firstclassprice + a6.firstclassprice) asc'853 else854 var tex = 'select a3.economyclassprice + a2.economyclassprice + a1.economyclassprice + a4.economyclassprice + a5.economyclassprice + a6.economyclassprice as tprice, ((a6.ddate - a4.date) + (a3.ddate - a1.date)) as duration, a4.iata as a4i, a5.iata as a5i, a6.iata as a6i, a1.iata as a1i,a2.iata as a2i,a3.iata as a3i, a4.diata as a4d, a5.diata as a5d, a6.diata as a6d, a1.diata as a1d,a2.diata as a2d,a3.diata as a3d,a1.economyclassprice as a1p,a2.economyclassprice as a2p,a3.economyclassprice as a3p,a4.economyclassprice as a4p,a6.economyclassprice as a6p,a5.economyclassprice as a5p, a1.eseat as a1s,a2.eseat as a2s,a3.eseat as a3s,a1.airlinecode as a1a,a2.airlinecode as a2a,a3.airlinecode as a3a,a4.eseat as a4s,a5.eseat as a5s,a6.eseat as a6s,a4.airlinecode as a4a,a5.airlinecode as a5a,a6.airlinecode as a6a, a3.flightnumber as a3f, a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a3.date as a3dt, a4.flightnumber as a4f, a5.flightnumber as a5f,a6.flightnumber as a6f,a4.date as a4dt,a5.date as a5dt,a6.date as a6dt, a3.ddate as a3ddt, a1.ddate as a1ddt,a2.ddate as a2ddt, a4.ddate as a4ddt, a5.ddate as a5ddt,a6.ddate as a6ddt from ((flight natural Join price) as a1 join (flight natural Join price) as a2 on a1.diata = a2.iata join (flight natural Join price) as a3 on a2.diata = a3.iata) cross join ((flight natural Join price) as a4 join (flight natural Join price) as a5 on a4.diata = a5.iata join (flight natural Join price) as a6 on a5.diata = a6.iata) where (a1.iata = $3 and (a3.economyclassprice + a2.economyclassprice + a1.economyclassprice + a4.economyclassprice + a5.economyclassprice + a6.economyclassprice) < $7 AND (a3.ddate - a1.date) < $8 and a3.diata = $4 and a1.eseat > 0 and a2.eseat > 0 and a3.eseat > 0 and a1.ddate <= a2.date and a2.ddate <= a3.date and a1.date >= $1 and a1.date < $5) AND (a4.iata = $4 AND a6.diata = $3 and a4.ddate <= a5.date and a4.eseat > 0 and a5.eseat > 0 and a6.eseat > 0 and a5.ddate <= a6.date and a4.date >= $2 and a4.date < $6) ORDER BY (a3.economyclassprice + a2.economyclassprice + a1.economyclassprice + a4.economyclassprice + a5.economyclassprice + a6.economyclassprice) asc'855 }856 client.query(tex, value, (err, res) => {857 if (err) {858 console.log (err.stack)859 done860 price = 100000861 duration = '150:00:00'862 response.sendFile('Web_design/wbooking.html', {root: __dirname })863 } 864 else{865 if (typeof(res.rows[0]) != "undefined"){866 console.log(res.rows)867 done868 price = 100000869 duration = '150:00:00'870 var result = []871 for(i = 0; i < res.rows.length; i++){872 hours = 0873 days = 0874 minutes = 0875 if(typeof (res.rows[i].duration.hours) != "undefined"){876 hours = res.rows[i].duration.hours877 }878 if(typeof (res.rows[i].duration.days) != "undefined"){879 days = res.rows[i].duration.days880 }881 if(typeof(res.rows[i].duration.minutes) != "undefined"){882 minutes = res.rows[i].duration.minutes883 }884 console.log(res.rows[i])885 result.push({886 duration : days+ ' days and ' +hours+ ' hours and '+minutes+ ' minutes',887 tprice : '$'+res.rows[i].tprice,888 class : test,889 ac1 : res.rows[i].a1a,890 fn1 : res.rows[i].a1f,891 iata1 : res.rows[i].a1i,892 diata1 : res.rows[i].a1d,893 dtime1 : ((res.rows[i].a1dt).toString()).substring(0,24),894 atime1 : ((res.rows[i].a1ddt).toString()).substring(0,24),895 seat1 : res.rows[i].a1s,896 price1 : res.rows[i].a1p,897 ac2 : res.rows[i].a2a,898 fn2 : res.rows[i].a2f,899 iata2 : res.rows[i].a2i,900 diata2 : res.rows[i].a2d,901 dtime2 : ((res.rows[i].a2dt).toString()).substring(0,24),902 atime2 : ((res.rows[i].a2ddt).toString()).substring(0,24),903 seat2 : res.rows[i].a2s,904 price2 : res.rows[i].a2p,905 ac3 : res.rows[i].a3a,906 fn3 : res.rows[i].a3f,907 iata3 : res.rows[i].a3i,908 diata3 : res.rows[i].a3d,909 dtime3 : ((res.rows[i].a3dt).toString()).substring(0,24),910 atime3 : ((res.rows[i].a3ddt).toString()).substring(0,24),911 seat3 : res.rows[i].a3s,912 price3 : res.rows[i].a3p,913 ac4 : res.rows[i].a4a,914 fn4 : res.rows[i].a4f,915 iata4 : res.rows[i].a4i,916 diata4 : res.rows[i].a4d,917 dtime4 : ((res.rows[i].a4dt).toString()).substring(0,24),918 atime4 : ((res.rows[i].a4ddt).toString()).substring(0,24),919 seat4 : res.rows[i].a4s,920 price4 : res.rows[i].a4p,921 ac5 : res.rows[i].a5a,922 fn5 : res.rows[i].a5f,923 iata5 : res.rows[i].a5i,924 diata5 : res.rows[i].a5d,925 dtime5 : ((res.rows[i].a5dt).toString()).substring(0,24),926 atime5 : ((res.rows[i].a5ddt).toString()).substring(0,24),927 seat5 : res.rows[i].a5s,928 price5 : res.rows[i].a5p,929 ac6 : res.rows[i].a6a,930 fn6 : res.rows[i].a6f,931 iata6 : res.rows[i].a6i,932 diata6 : res.rows[i].a6d,933 dtime6 : ((res.rows[i].a6dt).toString()).substring(0,24),934 atime6 : ((res.rows[i].a6ddt).toString()).substring(0,24),935 seat6 : res.rows[i].a6s,936 price6 : res.rows[i].a6p937 })938 }939 response.render('pages/rbooking2',{drinks : result})940 }941 else{942 console.log('empty')943 done944 price = 100000945 duration = '150:00:00'946 response.sendFile('Web_design/ebooking.html', {root: __dirname })947 }948 }949 })950 }951 else{952 var value = [req.body.ddate,req.body.iata,req.body.diata,req.body.ddate+' 24:00:00',price,duration]953 if(req.body.order == "Flight Length"){954 if(req.body.price == "First")955 var tex = 'select a3.firstclassprice + a2.firstclassprice + a3.firstclassprice as tprice, a3.ddate - a1.date as duration, a1.iata as a1i,a2.iata as a2i,a3.iata as a3i,a1.diata as a1d,a2.diata as a2d,a3.diata as a3d,a1.firstclassprice as a1p,a2.firstclassprice as a2p,a3.firstclassprice as a3p, a1.eseat as a1s,a2.eseat as a2s,a3.eseat as a3s,a1.airlinecode as a1a,a2.airlinecode as a2a,a3.airlinecode as a3a, a3.flightnumber as a3f, a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a3.date as a3dt, a3.ddate as a3ddt, a1.ddate as a1ddt,a2.ddate as a2ddt from (flight natural Join price) as a1 join (flight natural Join price) as a2 on a1.diata = a2.iata join (flight natural Join price) as a3 on a2.diata = a3.iata where (a1.iata = $2 and (a1.firstclassprice + a2.firstclassprice + a3.firstclassprice) < $5 AND (a3.ddate - a1.date) < $6 and a3.diata = $3 and a1.fseat > 0 and a2.fseat > 0 and a3.fseat > 0 and a1.ddate <= a2.date and a2.ddate <= a3.date and a1.date >= $1 and a1.date < $4) ORDER BY a3.ddate - a1.date asc'956 else957 var tex = 'select a3.economyclassprice + a2.economyclassprice + a3.economyclassprice as tprice, a3.ddate - a1.date as duration, a1.iata as a1i,a2.iata as a2i,a3.iata as a3i,a1.diata as a1d,a2.diata as a2d,a3.diata as a3d,a1.economyclassprice as a1p,a2.economyclassprice as a2p,a3.economyclassprice as a3p, a1.eseat as a1s,a2.eseat as a2s,a3.eseat as a3s,a1.airlinecode as a1a,a2.airlinecode as a2a,a3.airlinecode as a3a, a3.flightnumber as a3f, a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a3.date as a3dt, a3.ddate as a3ddt, a1.ddate as a1ddt,a2.ddate as a2ddt from (flight natural Join price) as a1 join (flight natural Join price) as a2 on a1.diata = a2.iata join (flight natural Join price) as a3 on a2.diata = a3.iata where (a1.iata = $2 and (a1.economyclassprice + a2.economyclassprice + a3.economyclassprice) < $5 AND (a3.ddate - a1.date) < $6 and a3.diata = $3 and a1.eseat > 0 and a2.eseat > 0 and a3.eseat > 0 and a1.ddate <= a2.date and a2.ddate <= a3.date and a1.date >= $1 and a1.date < $4) ORDER BY a3.ddate - a1.date asc'958 }959 else{960 if(req.body.price == "First")961 var tex = 'select a3.firstclassprice + a2.firstclassprice + a3.firstclassprice as tprice, a3.ddate - a1.date as duration, a1.iata as a1i,a2.iata as a2i,a3.iata as a3i,a1.diata as a1d,a2.diata as a2d,a3.diata as a3d,a1.firstclassprice as a1p,a2.firstclassprice as a2p,a3.firstclassprice as a3p, a1.eseat as a1s,a2.eseat as a2s,a3.eseat as a3s,a1.airlinecode as a1a,a2.airlinecode as a2a,a3.airlinecode as a3a, a3.flightnumber as a3f, a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a3.date as a3dt, a3.ddate as a3ddt, a1.ddate as a1ddt,a2.ddate as a2ddt from (flight natural Join price) as a1 join (flight natural Join price) as a2 on a1.diata = a2.iata join (flight natural Join price) as a3 on a2.diata = a3.iata where (a1.iata = $2 and (a1.firstclassprice + a2.firstclassprice + a3.firstclassprice) < $5 AND (a3.ddate - a1.date) < $6 and a3.diata = $3 and a1.fseat > 0 and a2.fseat > 0 and a3.fseat > 0 and a1.ddate <= a2.date and a2.ddate <= a3.date and a1.date >= $1 and a1.date < $4) ORDER BY a3.firstclassprice + a2.firstclassprice + a3.firstclassprice asc'962 else963 var tex = 'select a3.economyclassprice + a2.economyclassprice + a3.economyclassprice as tprice, a3.ddate - a1.date as duration, a1.iata as a1i,a2.iata as a2i,a3.iata as a3i,a1.diata as a1d,a2.diata as a2d,a3.diata as a3d,a1.economyclassprice as a1p,a2.economyclassprice as a2p,a3.economyclassprice as a3p, a1.eseat as a1s,a2.eseat as a2s,a3.eseat as a3s,a1.airlinecode as a1a,a2.airlinecode as a2a,a3.airlinecode as a3a, a3.flightnumber as a3f, a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a3.date as a3dt, a3.ddate as a3ddt, a1.ddate as a1ddt,a2.ddate as a2ddt from (flight natural Join price) as a1 join (flight natural Join price) as a2 on a1.diata = a2.iata join (flight natural Join price) as a3 on a2.diata = a3.iata where (a1.iata = $2 and (a1.economyclassprice + a2.economyclassprice + a3.economyclassprice) < $5 AND (a3.ddate - a1.date) < $6 and a3.diata = $3 and a1.eseat > 0 and a2.eseat > 0 and a3.eseat > 0 and a1.ddate <= a2.date and a2.ddate <= a3.date and a1.date >= $1 and a1.date < $4) ORDER BY a3.economyclassprice + a2.economyclassprice + a3.economyclassprice asc'964 }965 client.query(tex, value, (err, res) => {966 if (err) {967 console.log (err.stack)968 done969 price = 100000970 duration = '150:00:00'971 response.sendFile('Web_design/wbooking.html', {root: __dirname })972 } 973 else{974 if (typeof(res.rows[0]) != "undefined"){975 console.log(res.rows)976 done977 price = 100000978 duration = '150:00:00'979 var result = []980 for(i = 0; i < res.rows.length; i++){981 hours = 0982 days = 0983 minutes = 0984 if(typeof (res.rows[i].duration.hours) != "undefined"){985 hours = res.rows[i].duration.hours986 }987 if(typeof (res.rows[i].duration.days) != "undefined"){988 days = res.rows[i].duration.days989 }990 if(typeof(res.rows[i].duration.minutes) != "undefined"){991 minutes = res.rows[i].duration.minutes992 }993 console.log(res.rows[i])994 result.push({995 duration : days+ ' days and ' +hours+ ' hours and '+minutes+ ' minutes',996 tprice : '$'+res.rows[i].tprice,997 class : test,998 ac1 : res.rows[i].a1a,999 fn1 : res.rows[i].a1f,1000 iata1 : res.rows[i].a1i,1001 diata1 : res.rows[i].a1d,1002 dtime1 : ((res.rows[i].a1dt).toString()).substring(0,24),1003 atime1 : ((res.rows[i].a1ddt).toString()).substring(0,24),1004 seat1 : res.rows[i].a1s,1005 price1 : res.rows[i].a1p,1006 ac2 : res.rows[i].a2a,1007 fn2 : res.rows[i].a2f,1008 iata2 : res.rows[i].a2i,1009 diata2 : res.rows[i].a2d,1010 dtime2 : ((res.rows[i].a2dt).toString()).substring(0,24),1011 atime2 : ((res.rows[i].a2ddt).toString()).substring(0,24),1012 seat2 : res.rows[i].a2s,1013 price2 : res.rows[i].a2p,1014 ac3 : res.rows[i].a3a,1015 fn3 : res.rows[i].a3f,1016 iata3 : res.rows[i].a3i,1017 diata3 : res.rows[i].a3d,1018 dtime3 : ((res.rows[i].a3dt).toString()).substring(0,24),1019 atime3 : ((res.rows[i].a3ddt).toString()).substring(0,24),1020 seat3 : res.rows[i].a3s,1021 price3 : res.rows[i].a3p1022 })1023 }1024 response.render('pages/booking2',{drinks : result})1025 }1026 else{1027 console.log('empty')1028 done1029 price = 1000001030 duration = '150:00:00'1031 response.sendFile('Web_design/ebooking.html', {root: __dirname })1032 }1033 }1034 })1035 }1036 })1037 }1038 else if(req.body.conn == '1'){1039 pg.connect(conString, function (err, client, done) { // 1 Connection1040 if (err) {1041 return console.error('could not connect to postgres', err)1042 response.sendFile('Web_design/booking.html', {root: __dirname })1043 } 1044 var tex = ''1045 var value = []1046 if(req.body.check == "Search Round Trip Flights"){ 1047 var value = [req.body.ddate,req.body.adate,req.body.iata,req.body.diata,req.body.ddate+' 24:00:00',req.body.adate+ ' 24:00:00',price,duration]1048 if(req.body.order == "Flight Length"){1049 if(req.body.price == "First")1050 var tex = 'select a2.firstclassprice + a1.firstclassprice + a3.firstclassprice + a4.firstclassprice AS tprice, (a2.ddate - a1.date) + (a4.ddate - a3.date) AS duration,a1.iata as a1i, a3.iata as a3i, a4.iata as a4i, a2.iata as a2i, a4.diata as a4d, a3.diata as a3d, a1.diata as a1d,a2.diata as a2d,a3.firstclassprice as a3p, a4.firstclassprice as a4p, a1.firstclassprice as a1p,a2.firstclassprice as a2p,a3.fseat as a3s, a4.fseat as a4s, a1.fseat as a1s,a2.fseat as a2s,a1.airlinecode as a1a,a2.airlinecode as a2a, a3.airlinecode as a3a, a4.airlinecode as a4a, a1.flightnumber as a1f,a2.flightnumber as a2f, a3.flightnumber as a3f, a4.flightnumber as a4f, a3.date as a3dt, a4.date as a4dt, a1.date as a1dt,a2.date as a2dt, a3.ddate as a3ddt, a4.ddate as a4ddt, a1.ddate as a1ddt,a2.ddate as a2ddt from ((flight natural join price) as a1 join (flight natural join price) AS a2 on a1.diata = a2.iata) cross join ((flight natural join price) as a3 join (flight natural join price) AS a4 on a3.diata = a4.iata) where (a1.iata = $3 and a2.diata = $4 and (a2.firstclassprice + a1.firstclassprice + a3.firstclassprice + a4.firstclassprice) < $7 AND ((a2.ddate - a1.date) + (a4.ddate - a3.date)) < $8 AND a1.ddate < a2.date and a2.fseat > 0 and a1.fseat > 0 and a1.date >= $1 and a1.date < $5) AND (a3.iata = $4 and a4.diata = $3 and (a2.firstclassprice + a1.firstclassprice + a3.firstclassprice + a4.firstclassprice) < $7 AND ((a2.ddate - a1.date) + (a4.ddate - a3.date)) < $8 and a3.ddate < a4.date and a4.fseat > 0 and a3.fseat > 0 and a3.date >= $2 AND a3.date < $6) ORDER BY a2.ddate - a1.date ASC'1051 else1052 var tex = 'select a2.economyclassprice + a1.economyclassprice + a3.economyclassprice + a4.economyclassprice AS tprice, (a2.ddate - a1.date) + (a4.ddate - a3.date) AS duration,a1.iata as a1i, a3.iata as a3i, a4.iata as a4i, a2.iata as a2i, a4.diata as a4d, a3.diata as a3d, a1.diata as a1d,a2.diata as a2d,a3.economyclassprice as a3p, a4.economyclassprice as a4p, a1.economyclassprice as a1p,a2.economyclassprice as a2p,a3.eseat as a3s, a4.eseat as a4s, a1.eseat as a1s,a2.eseat as a2s,a1.airlinecode as a1a,a2.airlinecode as a2a, a3.airlinecode as a3a, a4.airlinecode as a4a, a1.flightnumber as a1f,a2.flightnumber as a2f, a3.flightnumber as a3f, a4.flightnumber as a4f, a3.date as a3dt, a4.date as a4dt, a1.date as a1dt,a2.date as a2dt, a3.ddate as a3ddt, a4.ddate as a4ddt, a1.ddate as a1ddt,a2.ddate as a2ddt from ((flight natural join price) as a1 join (flight natural join price) AS a2 on a1.diata = a2.iata) cross join ((flight natural join price) as a3 join (flight natural join price) AS a4 on a3.diata = a4.iata) where (a1.iata = $3 and a2.diata = $4 and (a2.economyclassprice + a1.economyclassprice + a3.economyclassprice + a4.economyclassprice) < $7 AND ((a2.ddate - a1.date) + (a4.ddate - a3.date)) < $8 AND a1.ddate < a2.date and a2.eseat > 0 and a1.eseat > 0 and a1.date >= $1 and a1.date < $5) AND (a3.iata = $4 and a4.diata = $3 and (a2.economyclassprice + a1.economyclassprice + a3.economyclassprice + a4.economyclassprice) < $7 AND ((a2.ddate - a1.date) + (a4.ddate - a3.date)) < $8 and a3.ddate < a4.date and a4.eseat > 0 and a3.eseat > 0 and a3.date >= $2 AND a3.date < $6) ORDER BY a2.ddate - a1.date ASC'1053 }1054 else{1055 if(req.body.price == "First")1056 var tex = 'select a2.firstclassprice + a1.firstclassprice + a3.firstclassprice + a4.firstclassprice AS tprice, (a2.ddate - a1.date) + (a4.ddate - a3.date) AS duration,a1.iata as a1i, a3.iata as a3i, a4.iata as a4i, a2.iata as a2i, a3.diata as a3d, a4.diata as a4d, a1.diata as a1d,a2.diata as a2d,a3.firstclassprice as a3p, a4.firstclassprice as a4p, a1.firstclassprice as a1p,a2.firstclassprice as a2p,a3.fseat as a3s, a4.fseat as a4s, a1.fseat as a1s,a2.fseat as a2s,a1.airlinecode as a1a,a2.airlinecode as a2a, a3.airlinecode as a3a, a4.airlinecode as a4a, a1.flightnumber as a1f,a2.flightnumber as a2f, a3.flightnumber as a3f, a4.flightnumber as a4f, a3.date as a3dt, a4.date as a4dt, a1.date as a1dt,a2.date as a2dt, a3.ddate as a3ddt, a4.ddate as a4ddt, a1.ddate as a1ddt,a2.ddate as a2ddt from ((flight natural join price) as a1 join (flight natural join price) AS a2 on a1.diata = a2.iata) cross join ((flight natural join price) as a3 join (flight natural join price) AS a4 on a3.diata = a4.iata) where (a1.iata = $3 and a2.diata = $4 and (a2.firstclassprice + a1.firstclassprice + a3.firstclassprice + a4.firstclassprice) < $7 AND ((a2.ddate - a1.date) + (a4.ddate - a3.date)) < $8 AND a1.ddate < a2.date and a2.fseat > 0 and a1.fseat > 0 and a1.date >= $1 and a1.date < $5) AND (a3.iata = $4 and a4.diata = $3 and (a2.firstclassprice + a1.firstclassprice + a3.firstclassprice + a4.firstclassprice) < $7 AND ((a2.ddate - a1.date) + (a4.ddate - a3.date)) < $8 and a3.ddate < a4.date and a4.fseat > 0 and a3.fseat > 0 and a3.date >= $2 AND a3.date < $6) ORDER BY a2.firstclassprice + a1.firstclassprice + a3.firstclassprice + a4.firstclassprice ASC'1057 else1058 var tex = 'select a2.economyclassprice + a1.economyclassprice + a3.economyclassprice + a4.economyclassprice AS tprice, (a2.ddate - a1.date) + (a4.ddate - a3.date) AS duration,a1.iata as a1i, a3.iata as a3i, a4.iata as a4i, a2.iata as a2i, a3.diata as a3d, a4.diata as a4d, a1.diata as a1d,a2.diata as a2d,a3.economyclassprice as a3p, a4.economyclassprice as a4p, a1.economyclassprice as a1p,a2.economyclassprice as a2p,a3.eseat as a3s, a4.eseat as a4s, a1.eseat as a1s,a2.eseat as a2s,a1.airlinecode as a1a,a2.airlinecode as a2a, a3.airlinecode as a3a, a4.airlinecode as a4a, a1.flightnumber as a1f,a2.flightnumber as a2f, a3.flightnumber as a3f, a4.flightnumber as a4f, a3.date as a3dt, a4.date as a4dt, a1.date as a1dt,a2.date as a2dt, a3.ddate as a3ddt, a4.ddate as a4ddt, a1.ddate as a1ddt,a2.ddate as a2ddt from ((flight natural join price) as a1 join (flight natural join price) AS a2 on a1.diata = a2.iata) cross join ((flight natural join price) as a3 join (flight natural join price) AS a4 on a3.diata = a4.iata) where (a1.iata = $3 and a2.diata = $4 and (a2.economyclassprice + a1.economyclassprice + a3.economyclassprice + a4.economyclassprice) < $7 AND ((a2.ddate - a1.date) + (a4.ddate - a3.date)) < $8 AND a1.ddate < a2.date and a2.eseat > 0 and a1.eseat > 0 and a1.date >= $1 and a1.date < $5) AND (a3.iata = $4 and a4.diata = $3 and (a2.economyclassprice + a1.economyclassprice + a3.economyclassprice + a4.economyclassprice) < $7 AND ((a2.ddate - a1.date) + (a4.ddate - a3.date)) < $8 and a3.ddate < a4.date and a4.eseat > 0 and a3.eseat > 0 and a3.date >= $2 AND a3.date < $6) ORDER BY a2.economyclassprice + a1.economyclassprice + a3.economyclassprice + a4.economyclassprice ASC'1059 }1060 client.query(tex, value, (err, res) => {1061 if (err) {1062 console.log (err.stack)1063 done1064 price = 1000001065 duration = '150:00:00'1066 response.sendFile('Web_design/wbooking.html', {root: __dirname })1067 } 1068 else{1069 if (typeof(res.rows[0]) != "undefined"){1070 console.log(res.rows)1071 done1072 price = 1000001073 duration = '150:00:00'1074 var result = []1075 for(i = 0; i < res.rows.length; i++){1076 hours = 01077 days = 01078 minutes = 01079 if(typeof (res.rows[i].duration.hours) != "undefined"){1080 hours = res.rows[i].duration.hours1081 }1082 if(typeof (res.rows[i].duration.days) != "undefined"){1083 days = res.rows[i].duration.days1084 }1085 if(typeof(res.rows[i].duration.minutes) != "undefined"){1086 minutes = res.rows[i].duration.minutes1087 }1088 console.log(res.rows[i])1089 result.push({1090 duration : days+ ' days and ' +hours+ ' hours and '+minutes+ ' minutes',1091 tprice : '$'+res.rows[i].tprice,1092 class : test,1093 ac1 : res.rows[i].a1a,1094 fn1 : res.rows[i].a1f,1095 iata1 : res.rows[i].a1i,1096 diata1 : res.rows[i].a1d,1097 dtime1 : ((res.rows[i].a1dt).toString()).substring(0,24),1098 atime1 : ((res.rows[i].a1ddt).toString()).substring(0,24),1099 seat1 : res.rows[i].a1s,1100 price1 : res.rows[i].a1p,1101 ac2 : res.rows[i].a2a,1102 fn2 : res.rows[i].a2f,1103 iata2 : res.rows[i].a2i,1104 diata2 : res.rows[i].a2d,1105 dtime2 : ((res.rows[i].a2dt).toString()).substring(0,24),1106 atime2 : ((res.rows[i].a2ddt).toString()).substring(0,24),1107 seat2 : res.rows[i].a2s,1108 price2 : res.rows[i].a2p,1109 ac3 : res.rows[i].a3a,1110 fn3 : res.rows[i].a3f,1111 iata3 : res.rows[i].a3i,1112 diata3 : res.rows[i].a3d,1113 dtime3 : ((res.rows[i].a3dt).toString()).substring(0,24),1114 atime3 : ((res.rows[i].a3ddt).toString()).substring(0,24),1115 seat3 : res.rows[i].a3s,1116 price3 : res.rows[i].a3p,1117 ac4 : res.rows[i].a4a,1118 fn4 : res.rows[i].a4f,1119 iata4 : res.rows[i].a4i,1120 diata4 : res.rows[i].a4d,1121 dtime4 : ((res.rows[i].a4dt).toString()).substring(0,24),1122 atime4 : ((res.rows[i].a4ddt).toString()).substring(0,24),1123 seat4 : res.rows[i].a4s,1124 price4 : res.rows[i].a4p1125 })1126 }1127 response.render('pages/rbooking1',{drinks : result})1128 }1129 else{1130 console.log('empty')1131 done1132 price = 1000001133 duration = '150:00:00'1134 response.sendFile('Web_design/ebooking.html', {root: __dirname })1135 }1136 }1137 })1138 }1139 else{1140 var value = [req.body.ddate,req.body.iata,req.body.diata,req.body.ddate+' 24:00:00',price,duration]1141 if(req.body.order == "Flight Length"){1142 if(req.body.price == "First")1143 var tex = 'select a2.firstclassprice + a1.firstclassprice AS tprice, a2.ddate - a1.date AS duration,a1.iata as a1i,a2.iata as a2i,a1.diata as a1d,a2.diata as a2d,a1.firstclassprice as a1p,a2.firstclassprice as a2p,a1.eseat as a1s,a2.eseat as a2s,a1.airlinecode as a1a,a2.airlinecode as a2a,a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a1.ddate as a1ddt,a2.ddate as a2ddt from (flight natural join price) as a1 join (flight natural join price) AS a2 on a1.diata = a2.iata where (a1.iata = $2 and (a1.firstclassprice + a2.firstclassprice) < $5 AND (a2.ddate - a1.date) < $6 and a2.diata = $3 and a1.ddate < a2.date and a2.fseat > 0 and a1.fseat > 0 and a1.date >= $1 and a1.date < $4) ORDER BY a2.ddate - a1.date ASC'1144 else1145 var tex = 'select a2.economyclassprice + a1.economyclassprice AS tprice, a2.ddate - a1.date AS duration,a1.iata as a1i,a2.iata as a2i,a1.diata as a1d,a2.diata as a2d,a1.economyclassprice as a1p,a2.economyclassprice as a2p,a1.eseat as a1s,a2.eseat as a2s,a1.airlinecode as a1a,a2.airlinecode as a2a,a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a1.ddate as a1ddt,a2.ddate as a2ddt from (flight natural join price) as a1 join (flight natural join price) AS a2 on a1.diata = a2.iata where (a1.iata = $2 and (a1.economyclassprice + a2.economyclassprice) < $5 AND (a2.ddate - a1.date) < $6 and a2.diata = $3 and a1.ddate < a2.date and a2.eseat > 0 and a1.eseat > 0 and a1.date >= $1 and a1.date < $4) ORDER BY a2.ddate - a1.date ASC'1146 }1147 else{1148 if(req.body.price == "First")1149 var tex = 'select a2.firstclassprice + a1.firstclassprice AS tprice, a2.ddate - a1.date AS duration,a1.iata as a1i,a2.iata as a2i,a1.diata as a1d,a2.diata as a2d,a1.firstclassprice as a1p,a2.firstclassprice as a2p,a1.eseat as a1s,a2.eseat as a2s,a1.airlinecode as a1a,a2.airlinecode as a2a,a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a1.ddate as a1ddt,a2.ddate as a2ddt from (flight join price ON flight.airlinecode = price.airlinecode AND flight.flightnumber = price.flightnumber) as a1 join (flight join price ON flight.airlinecode = price.airlinecode AND flight.flightnumber = price.flightnumber) AS a2 on a1.diata = a2.iata where (a1.iata = $2 and (a1.firstclassprice + a2.firstclassprice) < $5 AND (a2.ddate - a1.date) < $6 and a2.diata = $3 and a1.ddate < a2.date and a2.fseat > 0 and a1.fseat > 0 and a1.date >= $1 and a1.date < $4) ORDER BY a2.firstclassprice + a1.firstclassprice ASC'1150 else1151 var tex = 'select a2.economyclassprice + a1.economyclassprice AS tprice, a2.ddate - a1.date AS duration,a1.iata as a1i,a2.iata as a2i,a1.diata as a1d,a2.diata as a2d,a1.economyclassprice as a1p,a2.economyclassprice as a2p,a1.eseat as a1s,a2.eseat as a2s,a1.airlinecode as a1a,a2.airlinecode as a2a,a1.flightnumber as a1f,a2.flightnumber as a2f,a1.date as a1dt,a2.date as a2dt,a1.ddate as a1ddt,a2.ddate as a2ddt from (flight natural join price) as a1 join (flight natural join price) AS a2 on a1.diata = a2.iata where (a1.iata = $2 and (a1.economyclassprice + a2.economyclassprice) < $5 AND (a2.ddate - a1.date) < $6 and a2.diata = $3 and a1.ddate < a2.date and a2.eseat > 0 and a1.eseat > 0 and a1.date >= $1 and a1.date < $4) ORDER BY a2.economyclassprice + a1.economyclassprice ASC'1152 }1153 client.query(tex, value, (err, res) => {1154 if (err) {1155 console.log (err.stack)1156 done1157 price = 1000001158 duration = '150:00:00'1159 response.sendFile('Web_design/wbooking.html', {root: __dirname })1160 } 1161 else{1162 if (typeof(res.rows[0]) != "undefined"){1163 console.log(res.rows)1164 done1165 price = 1000001166 duration = '150:00:00'1167 var result = []1168 for(i = 0; i < res.rows.length; i++){1169 hours = 01170 days = 01171 minutes = 01172 if(typeof (res.rows[i].duration.hours) != "undefined"){1173 hours = res.rows[i].duration.hours1174 }1175 if(typeof (res.rows[i].duration.days) != "undefined"){1176 days = res.rows[i].duration.days1177 }1178 if(typeof(res.rows[i].duration.minutes) != "undefined"){1179 minutes = res.rows[i].duration.minutes1180 }1181 console.log(res.rows[i])1182 result.push({1183 duration : days+ ' days and ' +hours+ ' hours and '+minutes+ ' minutes',1184 tprice : '$'+res.rows[i].tprice,1185 class : test,1186 ac1 : res.rows[i].a1a,1187 fn1 : res.rows[i].a1f,1188 iata1 : res.rows[i].a1i,1189 diata1 : res.rows[i].a1d,1190 dtime1 : ((res.rows[i].a1dt).toString()).substring(0,24),1191 atime1 : ((res.rows[i].a1ddt).toString()).substring(0,24),1192 seat1 : res.rows[i].a1s,1193 price1 : res.rows[i].a1p,1194 ac2 : res.rows[i].a2a,1195 fn2 : res.rows[i].a2f,1196 iata2 : res.rows[i].a2i,1197 diata2 : res.rows[i].a2d,1198 dtime2 : ((res.rows[i].a2dt).toString()).substring(0,24),1199 atime2 : ((res.rows[i].a2ddt).toString()).substring(0,24),1200 seat2 : res.rows[i].a2s,1201 price2 : res.rows[i].a2p1202 })1203 }1204 response.render('pages/booking1',{drinks : result})1205 }1206 else{1207 console.log('empty')1208 done1209 price = 1000001210 duration = '150:00:00'1211 response.sendFile('Web_design/ebooking.html', {root: __dirname })1212 }1213 }1214 })1215 }1216 })1217 }1218 else{1219 pg.connect(conString, function (err, client, done) { // O connections1220 if (err) { 1221 return console.error('could not connect to postgres', err)1222 response.sendFile('Web_design/booking.html', {root: __dirname })1223 } 1224 var tex = ''1225 var value = []1226 if(req.body.check == "Search Round Trip Flights"){1227 var value = [req.body.ddate,req.body.adate,req.body.iata,req.body.diata,req.body.ddate+' 24:00:00',req.body.adate+ ' 24:00:00',price,duration]1228 if(req.body.order == "Flight Length"){1229 if(req.body.price == "First")1230 var tex = 'SELECT a1.airlinecode as ba1,a2.airlinecode as ba2,a1.flightnumber as bf1,a2.flightnumber as bf2,a1.iata as bi1, a2.iata as bi2, a1.date as bd1, a2.date as bd2, a1.ddate as bdd1, a2.ddate as bdd2, a1.diata as bdi1, a2.diata as bdi2, ((a2.ddate - a2.date) + (a1.ddate - a1.date)) AS duration, (a1.firstclassprice + a2.firstclassprice) as tprice, a1.fseat as um, a2.fseat as um2, * FROM (flight Natural Join price) AS a1 CROSS JOIN (flight Natural Join price) AS a2 WHERE ( (a1.date >= $1 AND a1.date < $5 AND a1.firstclassprice < $7 AND ((a2.ddate - a2.date) + (a1.ddate - a1.date)) < $8 AND a1.iata = $3 AND a1.diata = $4 AND a1.fseat > 0)) AND (a2.date >= $2 AND ((a2.ddate - a2.date) + (a1.ddate - a1.date)) < $8 AND a2.date < $6 AND a2.firstclassprice < $7 AND a2.iata = $4 AND a2.diata = $3 AND a2.fseat > 0) ORDER BY a2.ddate - a1.date ASC'1231 else1232 var tex = 'SELECT a1.airlinecode as ba1,a2.airlinecode as ba2,a1.flightnumber as bf1,a2.flightnumber as bf2,a1.iata as bi1, a2.iata as bi2, a1.date as bd1, a2.date as bd2, a1.ddate as bdd1, a2.ddate as bdd2, a1.diata as bdi1, a2.diata as bdi2,((a2.ddate - a2.date) + (a1.ddate - a1.date)) AS duration, (a1.economyclassprice + a2.economyclassprice) as tprice, a1.fseat as um, a2.fseat as um2, * FROM (flight Natural Join price) AS a1 CROSS JOIN (flight Natural Join price) AS a2 WHERE ( (a1.date >= $1 AND a1.date < $5 AND a1.economyclassprice < $7 AND ((a2.ddate - a2.date) + (a1.ddate - a1.date)) < $8 AND a1.iata = $3 AND a1.diata = $4 AND a1.eseat > 0)) AND (a2.date >= $2 AND ((a2.ddate - a2.date) + (a1.ddate - a1.date)) < $8 AND a2.date < $6 AND a2.economyclassprice < $7 AND a2.iata = $4 AND a2.diata = $3 AND a2.eseat > 0) ORDER BY a2.ddate - a1.date ASC'1233 }1234 else{1235 if(req.body.price == "First")1236 var tex = 'SELECT a1.airlinecode as ba1,a2.airlinecode as ba2,a1.flightnumber as bf1,a2.flightnumber as bf2,a1.iata as bi1, a2.iata as bi2, a1.date as bd1, a2.date as bd2, a1.ddate as bdd1, a2.ddate as bdd2, a1.diata as bdi1, a2.diata as bdi2,((a2.ddate - a2.date) + (a1.ddate - a1.date)) AS duration, (a1.firstclassprice + a2.firstclassprice) as tprice, a1.fseat as um, a2.fseat as um2, * FROM (flight Natural Join price) AS a1 CROSS JOIN (flight Natural Join price) AS a2 WHERE ( (a1.date >= $1 AND a1.date < $5 AND a1.firstclassprice < $7 AND ((a2.ddate - a2.date) + (a1.ddate - a1.date)) < $8 AND a1.iata = $3 AND a1.diata = $4 AND a1.fseat > 0)) AND (a2.date >= $2 AND ((a2.ddate - a2.date) + (a1.ddate - a1.date)) < $8 AND a2.date < $6 AND a2.firstclassprice < $7 AND a2.iata = $4 AND a2.diata = $3 AND a2.fseat > 0) ORDER BY a1.firstclassprice + a2.firstclassprice ASC'1237 else1238 var tex = 'SELECT a1.airlinecode as ba1,a2.airlinecode as ba2,a1.flightnumber as bf1,a2.flightnumber as bf2,a1.iata as bi1, a2.iata as bi2, a1.date as bd1, a2.date as bd2, a1.ddate as bdd1, a2.ddate as bdd2, a1.diata as bdi1, a2.diata as bdi2,((a2.ddate - a2.date) + (a1.ddate - a1.date)) AS duration, (a1.economyclassprice + a2.economyclassprice) as tprice, a1.fseat as um, a2.fseat as um2, * FROM (flight Natural Join price) AS a1 CROSS JOIN (flight Natural Join price) AS a2 WHERE ( (a1.date >= $1 AND a1.date < $5 AND a1.economyclassprice < $7 AND ((a2.ddate - a2.date) + (a1.ddate - a1.date)) < $8 AND a1.iata = $3 AND a1.diata = $4 AND a1.eseat > 0)) AND (a2.date >= $2 AND ((a2.ddate - a2.date) + (a1.ddate - a1.date)) < $8 AND a2.date < $6 AND a2.economyclassprice < $7 AND a2.iata = $4 AND a2.diata = $3 AND a2.eseat > 0) ORDER BY a2.ddate - a1.date ASC'1239 }1240 client.query(tex, value, (err, res) => {1241 if (err) {1242 console.log (err.stack)1243 done1244 price = 1000001245 duration = '150:00:00'1246 response.sendFile('Web_design/wbooking.html', {root: __dirname })1247 } 1248 else{1249 if (typeof(res.rows[0]) != "undefined"){1250 done1251 price = 1000001252 duration = '150:00:00'1253 console.log(res.rows[0])1254 var result = []1255 for(i = 0; i < res.rows.length; i++){1256 hours = 01257 days = 01258 minutes = 01259 if(typeof (res.rows[i].duration.hours) != "undefined"){1260 hours = res.rows[i].duration.hours1261 }1262 if(typeof (res.rows[i].duration.days) != "undefined"){1263 days = res.rows[i].duration.days1264 }1265 if(typeof(res.rows[i].duration.minutes) != "undefined"){1266 minutes = res.rows[i].duration.minutes1267 }1268 result.push({1269 duration : days+ ' days and ' +hours+ ' hours and '+minutes+ ' minutes',1270 tprice : '$'+res.rows[i].tprice,1271 class : test,1272 ac : res.rows[i].ba1,1273 fn : res.rows[i].bf1,1274 iata : res.rows[i].bi1,1275 diata : res.rows[i].bdi1,1276 dtime : ((res.rows[i].bd1).toString()).substring(0,24),1277 atime : ((res.rows[i].bdd1).toString()).substring(0,24),1278 seat : res.rows[i].um,1279 ac1 : res.rows[i].ba2,1280 fn1 : res.rows[i].bf2,1281 iata1 : res.rows[i].bi2,1282 diata1 : res.rows[i].bdi2,1283 dtime1 : ((res.rows[i].bd2).toString()).substring(0,24),1284 atime1 : ((res.rows[i].bdd2).toString()).substring(0,24),1285 seat1 : res.rows[i].um21286 })1287 }1288 console.log(result)1289 response.render('pages/rbooking',{drinks : result})1290 }1291 else{1292 console.log('empty O connections')1293 done1294 price = 1000001295 duration = '150:00:00'1296 response.sendFile('Web_design/ebooking.html', {root: __dirname })1297 }1298 }1299 })1300 }1301 else{1302 var value = [req.body.ddate,req.body.iata,req.body.diata,req.body.ddate+' 24:00:00',price,duration]1303 if(req.body.order == "Flight Length"){1304 if(req.body.price == "First")1305 var tex = 'SELECT (flight.ddate - flight.date) AS duration, price.firstclassprice as tprice, flight.fseat as gg, * FROM flight Join price ON flight.airlinecode = price.airlinecode AND flight.flightnumber = price.flightnumber WHERE (flight.date >= $1 AND (flight.ddate - flight.date) < $6 AND flight.date < $4 AND price.firstclassprice < $5 AND flight.iata = $2 AND flight.diata = $3 AND flight.fseat > 0) ORDER BY flight.ddate - flight.date ASC'1306 else1307 var tex = 'SELECT (flight.ddate - flight.date) AS duration, price.economyclassprice as tprice, flight.eseat as gg, * FROM flight Join price ON flight.airlinecode = price.airlinecode AND flight.flightnumber = price.flightnumber WHERE (flight.date >= $1 AND (flight.ddate - flight.date) < $6 AND flight.date < $4 AND price.economyclassprice < $5 AND flight.iata = $2 AND flight.diata = $3 AND flight.eseat > 0) ORDER BY flight.ddate - flight.date ASC'1308 }1309 else{1310 if(req.body.price == "First")1311 var tex = 'SELECT (flight.ddate - flight.date) AS duration, price.firstclassprice as tprice,flight.fseat as gg, * FROM flight Join price ON flight.airlinecode = price.airlinecode AND flight.flightnumber = price.flightnumber WHERE (flight.date >= $1 AND (flight.ddate - flight.date) < $6 AND flight.date < $4 AND price.firstclassprice < $5 AND flight.iata = $2 AND flight.diata = $3 AND flight.fseat > 0) ORDER BY price.firstclassprice ASC'1312 else1313 var tex = 'SELECT (flight.ddate - flight.date) AS duration, price.economyclassprice as tprice,flight.eseat as gg, * FROM flight Join price ON flight.airlinecode = price.airlinecode AND flight.flightnumber = price.flightnumber WHERE (flight.date >= $1 AND (flight.ddate - flight.date) < $6 AND flight.date < $4 AND price.economyclassprice < $5 AND flight.iata = $2 AND flight.diata = $3 AND flight.eseat > 0) ORDER BY price.economyclassprice ASC'1314 }1315 client.query(tex, value, (err, res) => {1316 if (err) {1317 console.log (err.stack)1318 done1319 price = 1000001320 duration = '150:00:00'1321 response.sendFile('Web_design/wbooking.html', {root: __dirname })1322 } 1323 else{1324 if (typeof(res.rows[0]) != "undefined"){1325 done1326 price = 1000001327 duration = '150:00:00'1328 var result = []1329 for(i = 0; i < res.rows.length; i++){1330 hours = 01331 days = 01332 minutes = 01333 if(typeof(res.rows[i].duration.hours) != "undefined"){1334 hours = res.rows[i].duration.hours1335 }1336 if(typeof(res.rows[i].duration.days) != "undefined"){1337 days = res.rows[i].duration.days1338 }1339 if(typeof(res.rows[i].duration.minutes) != "undefined"){1340 minutes = res.rows[i].duration.minutes1341 }1342 result.push({1343 duration : days+ ' days and ' +hours+ ' hours and '+minutes+ ' minutes',1344 tprice : '$'+res.rows[i].tprice,1345 class : test,1346 ac : res.rows[i].airlinecode,1347 fn : res.rows[i].flightnumber,1348 iata : res.rows[i].iata,1349 diata : res.rows[i].diata,1350 dtime : ((res.rows[i].date).toString()).substring(0,24),1351 atime : ((res.rows[i].ddate).toString()).substring(0,24),1352 seat : res.rows[i].gg1353 })1354 }1355 console.log(result)1356 response.render('pages/booking',{drinks : result})1357 }1358 else{1359 console.log('empty O connections')1360 done1361 price = 1000001362 duration = '150:00:00'1363 response.sendFile('Web_design/ebooking.html', {root: __dirname })1364 }1365 }1366 })1367 }1368 })1369 }1370})1371app.listen(8080, function(){1372 pg.connect(conString, function (err, client, done) {1373 if (err) {1374 return console.error('could not connect to postgres', err)1375 } 1376 const text5 = 'SELECT MAX(bookingnumber) as book FROM booking'1377 const values5 = []1378 client.query(text5, values5, (err, res) => {1379 if (err) {1380 console.log (err.stack)1381 done1382 } else{1383 var temp = parseInt(res.rows[0].book) + 11384 if(temp >= bookingnumber){1385 bookingnumber = temp1386 }1387 done1388 }1389 })1390 })1391 console.log('Server running at http://127.0.0.1:8080/');...

Full Screen

Full Screen

Resolver-test.js

Source:Resolver-test.js Github

copy

Full Screen

1/**2 * Copyright (c) 2015-present, Facebook, Inc.3 * All rights reserved.4 *5 * This source code is licensed under the BSD-style license found in the6 * LICENSE file in the root directory of this source tree. An additional grant7 * of patent rights can be found in the PATENTS file in the same directory.8 */9'use strict';10jest.dontMock('../')11 .dontMock('underscore')12 .dontMock('../../DependencyResolver/lib/extractRequires')13 .dontMock('../../DependencyResolver/lib/replacePatterns');14jest.mock('path');15var Promise = require('promise');16var Resolver = require('../');17var Module = require('../../DependencyResolver/Module');18var Polyfill = require('../../DependencyResolver/Polyfill');19var DependencyGraph = require('../../DependencyResolver/DependencyGraph');20var path = require('path');21var _ = require('underscore');22describe('Resolver', function() {23 beforeEach(function() {24 Polyfill.mockClear();25 // For the polyfillDeps26 path.join.mockImpl(function(a, b) {27 return b;28 });29 });30 class ResolutionResponseMock {31 constructor({dependencies, mainModuleId, asyncDependencies}) {32 this.dependencies = dependencies;33 this.mainModuleId = mainModuleId;34 this.asyncDependencies = asyncDependencies;35 }36 prependDependency(dependency) {37 this.dependencies.unshift(dependency);38 }39 finalize() {40 return Promise.resolve(this);41 }42 }43 function createModule(id, dependencies) {44 var module = new Module();45 module.getName.mockImpl(() => Promise.resolve(id));46 module.getDependencies.mockImpl(() => Promise.resolve(dependencies));47 return module;48 }49 describe('getDependencies', function() {50 pit('should get dependencies with polyfills', function() {51 var module = createModule('index');52 var deps = [module];53 var depResolver = new Resolver({54 projectRoot: '/root',55 });56 DependencyGraph.prototype.getDependencies.mockImpl(function() {57 return Promise.resolve(new ResolutionResponseMock({58 dependencies: deps,59 mainModuleId: 'index',60 asyncDependencies: [],61 }));62 });63 return depResolver.getDependencies('/root/index.js', { dev: false })64 .then(function(result) {65 expect(result.mainModuleId).toEqual('index');66 expect(result.dependencies[result.dependencies.length - 1]).toBe(module);67 expect(_.pluck(Polyfill.mock.calls, 0)).toEqual([68 { path: 'polyfills/polyfills.js',69 id: 'polyfills/polyfills.js',70 isPolyfill: true,71 dependencies: []72 },73 { id: 'polyfills/console.js',74 isPolyfill: true,75 path: 'polyfills/console.js',76 dependencies: [77 'polyfills/polyfills.js'78 ],79 },80 { id: 'polyfills/error-guard.js',81 isPolyfill: true,82 path: 'polyfills/error-guard.js',83 dependencies: [84 'polyfills/polyfills.js',85 'polyfills/console.js'86 ],87 },88 { id: 'polyfills/String.prototype.es6.js',89 isPolyfill: true,90 path: 'polyfills/String.prototype.es6.js',91 dependencies: [92 'polyfills/polyfills.js',93 'polyfills/console.js',94 'polyfills/error-guard.js'95 ],96 },97 { id: 'polyfills/Array.prototype.es6.js',98 isPolyfill: true,99 path: 'polyfills/Array.prototype.es6.js',100 dependencies: [101 'polyfills/polyfills.js',102 'polyfills/console.js',103 'polyfills/error-guard.js',104 'polyfills/String.prototype.es6.js',105 ],106 },107 { id: 'polyfills/Array.es6.js',108 isPolyfill: true,109 path: 'polyfills/Array.es6.js',110 dependencies: [111 'polyfills/polyfills.js',112 'polyfills/console.js',113 'polyfills/error-guard.js',114 'polyfills/String.prototype.es6.js',115 'polyfills/Array.prototype.es6.js',116 ],117 },118 { id: 'polyfills/babelHelpers.js',119 isPolyfill: true,120 path: 'polyfills/babelHelpers.js',121 dependencies: [122 'polyfills/polyfills.js',123 'polyfills/console.js',124 'polyfills/error-guard.js',125 'polyfills/String.prototype.es6.js',126 'polyfills/Array.prototype.es6.js',127 'polyfills/Array.es6.js',128 ],129 },130 ]);131 });132 });133 pit('should get dependencies with polyfills', function() {134 var module = createModule('index');135 var deps = [module];136 var depResolver = new Resolver({137 projectRoot: '/root',138 });139 DependencyGraph.prototype.getDependencies.mockImpl(function() {140 return Promise.resolve(new ResolutionResponseMock({141 dependencies: deps,142 mainModuleId: 'index',143 asyncDependencies: [],144 }));145 });146 return depResolver.getDependencies('/root/index.js', { dev: true })147 .then(function(result) {148 expect(result.mainModuleId).toEqual('index');149 expect(DependencyGraph.mock.instances[0].getDependencies).toBeCalledWith('/root/index.js', undefined);150 expect(result.dependencies[0]).toBe(Polyfill.mock.instances[0]);151 expect(result.dependencies[result.dependencies.length - 1])152 .toBe(module);153 });154 });155 pit('should pass in more polyfills', function() {156 var module = createModule('index');157 var deps = [module];158 var depResolver = new Resolver({159 projectRoot: '/root',160 polyfillModuleNames: ['some module'],161 });162 DependencyGraph.prototype.getDependencies.mockImpl(function() {163 return Promise.resolve(new ResolutionResponseMock({164 dependencies: deps,165 mainModuleId: 'index',166 asyncDependencies: [],167 }));168 });169 return depResolver.getDependencies('/root/index.js', { dev: false })170 .then((result) => {171 expect(result.mainModuleId).toEqual('index');172 expect(Polyfill.mock.calls[result.dependencies.length - 2]).toEqual([173 { path: 'some module',174 id: 'some module',175 isPolyfill: true,176 dependencies: [177 'polyfills/polyfills.js',178 'polyfills/console.js',179 'polyfills/error-guard.js',180 'polyfills/String.prototype.es6.js',181 'polyfills/Array.prototype.es6.js',182 'polyfills/Array.es6.js',183 'polyfills/babelHelpers.js',184 ]185 },186 ]);187 });188 });189 });190 describe('wrapModule', function() {191 pit('should resolve modules', function() {192 var depResolver = new Resolver({193 projectRoot: '/root',194 });195 var dependencies = ['x', 'y', 'z', 'a', 'b'];196 /*eslint-disable */197 var code = [198 // single line import199 "import'x';",200 "import 'x';",201 "import 'x' ;",202 "import Default from 'x';",203 "import * as All from 'x';",204 "import {} from 'x';",205 "import { } from 'x';",206 "import {Foo} from 'x';",207 "import { Foo } from 'x';",208 "import { Foo, } from 'x';",209 "import {Foo as Bar} from 'x';",210 "import { Foo as Bar } from 'x';",211 "import { Foo as Bar, } from 'x';",212 "import { Foo, Bar } from 'x';",213 "import { Foo, Bar, } from 'x';",214 "import { Foo as Bar, Baz } from 'x';",215 "import { Foo as Bar, Baz, } from 'x';",216 "import { Foo, Bar as Baz } from 'x';",217 "import { Foo, Bar as Baz, } from 'x';",218 "import { Foo as Bar, Baz as Qux } from 'x';",219 "import { Foo as Bar, Baz as Qux, } from 'x';",220 "import { Foo, Bar, Baz } from 'x';",221 "import { Foo, Bar, Baz, } from 'x';",222 "import { Foo as Bar, Baz, Qux } from 'x';",223 "import { Foo as Bar, Baz, Qux, } from 'x';",224 "import { Foo, Bar as Baz, Qux } from 'x';",225 "import { Foo, Bar as Baz, Qux, } from 'x';",226 "import { Foo, Bar, Baz as Qux } from 'x';",227 "import { Foo, Bar, Baz as Qux, } from 'x';",228 "import { Foo as Bar, Baz as Qux, Norf } from 'x';",229 "import { Foo as Bar, Baz as Qux, Norf, } from 'x';",230 "import { Foo as Bar, Baz, Qux as Norf } from 'x';",231 "import { Foo as Bar, Baz, Qux as Norf, } from 'x';",232 "import { Foo, Bar as Baz, Qux as Norf } from 'x';",233 "import { Foo, Bar as Baz, Qux as Norf, } from 'x';",234 "import { Foo as Bar, Baz as Qux, Norf as Enuf } from 'x';",235 "import { Foo as Bar, Baz as Qux, Norf as Enuf, } from 'x';",236 "import Default, * as All from 'x';",237 "import Default, { } from 'x';",238 "import Default, { Foo } from 'x';",239 "import Default, { Foo, } from 'x';",240 "import Default, { Foo as Bar } from 'x';",241 "import Default, { Foo as Bar, } from 'x';",242 "import Default, { Foo, Bar } from 'x';",243 "import Default, { Foo, Bar, } from 'x';",244 "import Default, { Foo as Bar, Baz } from 'x';",245 "import Default, { Foo as Bar, Baz, } from 'x';",246 "import Default, { Foo, Bar as Baz } from 'x';",247 "import Default, { Foo, Bar as Baz, } from 'x';",248 "import Default, { Foo as Bar, Baz as Qux } from 'x';",249 "import Default, { Foo as Bar, Baz as Qux, } from 'x';",250 "import Default, { Foo, Bar, Baz } from 'x';",251 "import Default, { Foo, Bar, Baz, } from 'x';",252 "import Default, { Foo as Bar, Baz, Qux } from 'x';",253 "import Default, { Foo as Bar, Baz, Qux, } from 'x';",254 "import Default, { Foo, Bar as Baz, Qux } from 'x';",255 "import Default, { Foo, Bar as Baz, Qux, } from 'x';",256 "import Default, { Foo, Bar, Baz as Qux } from 'x';",257 "import Default, { Foo, Bar, Baz as Qux, } from 'x';",258 "import Default, { Foo as Bar, Baz as Qux, Norf } from 'x';",259 "import Default, { Foo as Bar, Baz as Qux, Norf, } from 'x';",260 "import Default, { Foo as Bar, Baz, Qux as Norf } from 'x';",261 "import Default, { Foo as Bar, Baz, Qux as Norf, } from 'x';",262 "import Default, { Foo, Bar as Baz, Qux as Norf } from 'x';",263 "import Default, { Foo, Bar as Baz, Qux as Norf, } from 'x';",264 "import Default, { Foo as Bar, Baz as Qux, Norf as NoMore } from 'x';",265 "import Default, { Foo as Bar, Baz as Qux, Norf as NoMore, } from 'x';",266 "import Default , { } from 'x';",267 'import "x";',268 'import Default from "x";',269 'import * as All from "x";',270 'import { } from "x";',271 'import { Foo } from "x";',272 'import { Foo, } from "x";',273 'import { Foo as Bar } from "x";',274 'import { Foo as Bar, } from "x";',275 'import { Foo, Bar } from "x";',276 'import { Foo, Bar, } from "x";',277 'import { Foo as Bar, Baz } from "x";',278 'import { Foo as Bar, Baz, } from "x";',279 'import { Foo, Bar as Baz } from "x";',280 'import { Foo, Bar as Baz, } from "x";',281 'import { Foo as Bar, Baz as Qux } from "x";',282 'import { Foo as Bar, Baz as Qux, } from "x";',283 'import { Foo, Bar, Baz } from "x";',284 'import { Foo, Bar, Baz, } from "x";',285 'import { Foo as Bar, Baz, Qux } from "x";',286 'import { Foo as Bar, Baz, Qux, } from "x";',287 'import { Foo, Bar as Baz, Qux } from "x";',288 'import { Foo, Bar as Baz, Qux, } from "x";',289 'import { Foo, Bar, Baz as Qux } from "x";',290 'import { Foo, Bar, Baz as Qux, } from "x";',291 'import { Foo as Bar, Baz as Qux, Norf } from "x";',292 'import { Foo as Bar, Baz as Qux, Norf, } from "x";',293 'import { Foo as Bar, Baz, Qux as Norf } from "x";',294 'import { Foo as Bar, Baz, Qux as Norf, } from "x";',295 'import { Foo, Bar as Baz, Qux as Norf } from "x";',296 'import { Foo, Bar as Baz, Qux as Norf, } from "x";',297 'import { Foo as Bar, Baz as Qux, Norf as NoMore } from "x";',298 'import { Foo as Bar, Baz as Qux, Norf as NoMore, } from "x";',299 'import Default, * as All from "x";',300 'import Default, { } from "x";',301 'import Default, { Foo } from "x";',302 'import Default, { Foo, } from "x";',303 'import Default, { Foo as Bar } from "x";',304 'import Default, { Foo as Bar, } from "x";',305 'import Default, { Foo, Bar } from "x";',306 'import Default, { Foo, Bar, } from "x";',307 'import Default, { Foo as Bar, Baz } from "x";',308 'import Default, { Foo as Bar, Baz, } from "x";',309 'import Default, { Foo, Bar as Baz } from "x";',310 'import Default, { Foo, Bar as Baz, } from "x";',311 'import Default, { Foo as Bar, Baz as Qux } from "x";',312 'import Default, { Foo as Bar, Baz as Qux, } from "x";',313 'import Default, { Foo, Bar, Baz } from "x";',314 'import Default, { Foo, Bar, Baz, } from "x";',315 'import Default, { Foo as Bar, Baz, Qux } from "x";',316 'import Default, { Foo as Bar, Baz, Qux, } from "x";',317 'import Default, { Foo, Bar as Baz, Qux } from "x";',318 'import Default, { Foo, Bar as Baz, Qux, } from "x";',319 'import Default, { Foo, Bar, Baz as Qux } from "x";',320 'import Default, { Foo, Bar, Baz as Qux, } from "x";',321 'import Default, { Foo as Bar, Baz as Qux, Norf } from "x";',322 'import Default, { Foo as Bar, Baz as Qux, Norf, } from "x";',323 'import Default, { Foo as Bar, Baz, Qux as Norf } from "x";',324 'import Default, { Foo as Bar, Baz, Qux as Norf, } from "x";',325 'import Default, { Foo, Bar as Baz, Qux as Norf } from "x";',326 'import Default, { Foo, Bar as Baz, Qux as Norf, } from "x";',327 'import Default, { Foo as Bar, Baz as Qux, Norf as Enuf } from "x";',328 'import Default, { Foo as Bar, Baz as Qux, Norf as Enuf, } from "x";',329 'import Default from "y";',330 'import * as All from \'z\';',331 // import with support for new lines332 "import { Foo,\n Bar }\n from 'x';",333 "import { \nFoo,\nBar,\n }\n from 'x';",334 "import { Foo as Bar,\n Baz\n }\n from 'x';",335 "import { \nFoo as Bar,\n Baz\n, }\n from 'x';",336 "import { Foo,\n Bar as Baz\n }\n from 'x';",337 "import { Foo,\n Bar as Baz,\n }\n from 'x';",338 "import { Foo as Bar,\n Baz as Qux\n }\n from 'x';",339 "import { Foo as Bar,\n Baz as Qux,\n }\n from 'x';",340 "import { Foo,\n Bar,\n Baz }\n from 'x';",341 "import { Foo,\n Bar,\n Baz,\n }\n from 'x';",342 "import { Foo as Bar,\n Baz,\n Qux\n }\n from 'x';",343 "import { Foo as Bar,\n Baz,\n Qux,\n }\n from 'x';",344 "import { Foo,\n Bar as Baz,\n Qux\n }\n from 'x';",345 "import { Foo,\n Bar as Baz,\n Qux,\n }\n from 'x';",346 "import { Foo,\n Bar,\n Baz as Qux\n }\n from 'x';",347 "import { Foo,\n Bar,\n Baz as Qux,\n }\n from 'x';",348 "import { Foo as Bar,\n Baz as Qux,\n Norf\n }\n from 'x';",349 "import { Foo as Bar,\n Baz as Qux,\n Norf,\n }\n from 'x';",350 "import { Foo as Bar,\n Baz,\n Qux as Norf\n }\n from 'x';",351 "import { Foo as Bar,\n Baz,\n Qux as Norf,\n }\n from 'x';",352 "import { Foo,\n Bar as Baz,\n Qux as Norf\n }\n from 'x';",353 "import { Foo,\n Bar as Baz,\n Qux as Norf,\n }\n from 'x';",354 "import { Foo as Bar,\n Baz as Qux,\n Norf as Enuf\n }\n from 'x';",355 "import { Foo as Bar,\n Baz as Qux,\n Norf as Enuf,\n }\n from 'x';",356 "import Default,\n * as All from 'x';",357 "import Default,\n { } from 'x';",358 "import Default,\n { Foo\n }\n from 'x';",359 "import Default,\n { Foo,\n }\n from 'x';",360 "import Default,\n { Foo as Bar\n }\n from 'x';",361 "import Default,\n { Foo as Bar,\n }\n from 'x';",362 "import Default,\n { Foo,\n Bar\n } from\n 'x';",363 "import Default,\n { Foo,\n Bar,\n } from\n 'x';",364 "import Default,\n { Foo as Bar,\n Baz\n }\n from 'x';",365 "import Default,\n { Foo as Bar,\n Baz,\n }\n from 'x';",366 "import Default,\n { Foo,\n Bar as Baz\n }\n from 'x';",367 "import Default,\n { Foo,\n Bar as Baz,\n }\n from 'x';",368 "import Default,\n { Foo as Bar,\n Baz as Qux\n }\n from 'x';",369 "import Default,\n { Foo as Bar,\n Baz as Qux,\n }\n from 'x';",370 "import Default,\n { Foo,\n Bar,\n Baz\n }\n from 'x';",371 "import Default,\n { Foo,\n Bar,\n Baz,\n }\n from 'x';",372 "import Default,\n { Foo as Bar,\n Baz,\n Qux\n }\n from 'x';",373 "import Default,\n { Foo as Bar,\n Baz,\n Qux,\n }\n from 'x';",374 "import Default,\n { Foo,\n Bar as Baz,\n Qux\n }\n from 'x';",375 "import Default,\n { Foo,\n Bar as Baz,\n Qux,\n }\n from 'x';",376 "import Default,\n { Foo,\n Bar,\n Baz as Qux\n }\n from 'x';",377 "import Default,\n { Foo,\n Bar,\n Baz as Qux,\n }\n from 'x';",378 "import Default,\n { Foo as Bar,\n Baz as Qux,\n Norf\n }\n from 'x';",379 "import Default,\n { Foo as Bar,\n Baz as Qux,\n Norf,\n }\n from 'x';",380 "import Default,\n { Foo as Bar,\n Baz,\n Qux as Norf }\n from 'x';",381 "import Default,\n { Foo as Bar,\n Baz,\n Qux as Norf, }\n from 'x';",382 "import Default,\n { Foo, Bar as Baz,\n Qux as Norf }\n from 'x';",383 "import Default,\n { Foo, Bar as Baz,\n Qux as Norf, }\n from 'x';",384 "import Default,\n { Foo as Bar,\n Baz as Qux,\n Norf as NoMore\n }\n from 'x';",385 "import Default,\n { Foo as Bar,\n Baz as Qux,\n Norf as NoMore,\n }\n from 'x';",386 "import Default\n , { } from 'x';",387 // single line export388 "export'x';",389 "export 'x';",390 "export 'x' ;",391 "export Default from 'x';",392 "export * as All from 'x';",393 "export {} from 'x';",394 "export { } from 'x';",395 "export {Foo} from 'x';",396 "export { Foo } from 'x';",397 "export { Foo, } from 'x';",398 "export {Foo as Bar} from 'x';",399 "export { Foo as Bar } from 'x';",400 "export { Foo as Bar, } from 'x';",401 "export { Foo, Bar } from 'x';",402 "export { Foo, Bar, } from 'x';",403 "export { Foo as Bar, Baz } from 'x';",404 "export { Foo as Bar, Baz, } from 'x';",405 "export { Foo, Bar as Baz } from 'x';",406 "export { Foo, Bar as Baz, } from 'x';",407 "export { Foo as Bar, Baz as Qux } from 'x';",408 "export { Foo as Bar, Baz as Qux, } from 'x';",409 "export { Foo, Bar, Baz } from 'x';",410 "export { Foo, Bar, Baz, } from 'x';",411 "export { Foo as Bar, Baz, Qux } from 'x';",412 "export { Foo as Bar, Baz, Qux, } from 'x';",413 "export { Foo, Bar as Baz, Qux } from 'x';",414 "export { Foo, Bar as Baz, Qux, } from 'x';",415 "export { Foo, Bar, Baz as Qux } from 'x';",416 "export { Foo, Bar, Baz as Qux, } from 'x';",417 "export { Foo as Bar, Baz as Qux, Norf } from 'x';",418 "export { Foo as Bar, Baz as Qux, Norf, } from 'x';",419 "export { Foo as Bar, Baz, Qux as Norf } from 'x';",420 "export { Foo as Bar, Baz, Qux as Norf, } from 'x';",421 "export { Foo, Bar as Baz, Qux as Norf } from 'x';",422 "export { Foo, Bar as Baz, Qux as Norf, } from 'x';",423 "export { Foo as Bar, Baz as Qux, Norf as Enuf } from 'x';",424 "export { Foo as Bar, Baz as Qux, Norf as Enuf, } from 'x';",425 "export Default, * as All from 'x';",426 "export Default, { } from 'x';",427 "export Default, { Foo } from 'x';",428 "export Default, { Foo, } from 'x';",429 "export Default, { Foo as Bar } from 'x';",430 "export Default, { Foo as Bar, } from 'x';",431 "export Default, { Foo, Bar } from 'x';",432 "export Default, { Foo, Bar, } from 'x';",433 "export Default, { Foo as Bar, Baz } from 'x';",434 "export Default, { Foo as Bar, Baz, } from 'x';",435 "export Default, { Foo, Bar as Baz } from 'x';",436 "export Default, { Foo, Bar as Baz, } from 'x';",437 "export Default, { Foo as Bar, Baz as Qux } from 'x';",438 "export Default, { Foo as Bar, Baz as Qux, } from 'x';",439 "export Default, { Foo, Bar, Baz } from 'x';",440 "export Default, { Foo, Bar, Baz, } from 'x';",441 "export Default, { Foo as Bar, Baz, Qux } from 'x';",442 "export Default, { Foo as Bar, Baz, Qux, } from 'x';",443 "export Default, { Foo, Bar as Baz, Qux } from 'x';",444 "export Default, { Foo, Bar as Baz, Qux, } from 'x';",445 "export Default, { Foo, Bar, Baz as Qux } from 'x';",446 "export Default, { Foo, Bar, Baz as Qux, } from 'x';",447 "export Default, { Foo as Bar, Baz as Qux, Norf } from 'x';",448 "export Default, { Foo as Bar, Baz as Qux, Norf, } from 'x';",449 "export Default, { Foo as Bar, Baz, Qux as Norf } from 'x';",450 "export Default, { Foo as Bar, Baz, Qux as Norf, } from 'x';",451 "export Default, { Foo, Bar as Baz, Qux as Norf } from 'x';",452 "export Default, { Foo, Bar as Baz, Qux as Norf, } from 'x';",453 "export Default, { Foo as Bar, Baz as Qux, Norf as NoMore } from 'x';",454 "export Default, { Foo as Bar, Baz as Qux, Norf as NoMore, } from 'x';",455 "export Default , { } from 'x';",456 'export "x";',457 'export Default from "x";',458 'export * as All from "x";',459 'export { } from "x";',460 'export { Foo } from "x";',461 'export { Foo, } from "x";',462 'export { Foo as Bar } from "x";',463 'export { Foo as Bar, } from "x";',464 'export { Foo, Bar } from "x";',465 'export { Foo, Bar, } from "x";',466 'export { Foo as Bar, Baz } from "x";',467 'export { Foo as Bar, Baz, } from "x";',468 'export { Foo, Bar as Baz } from "x";',469 'export { Foo, Bar as Baz, } from "x";',470 'export { Foo as Bar, Baz as Qux } from "x";',471 'export { Foo as Bar, Baz as Qux, } from "x";',472 'export { Foo, Bar, Baz } from "x";',473 'export { Foo, Bar, Baz, } from "x";',474 'export { Foo as Bar, Baz, Qux } from "x";',475 'export { Foo as Bar, Baz, Qux, } from "x";',476 'export { Foo, Bar as Baz, Qux } from "x";',477 'export { Foo, Bar as Baz, Qux, } from "x";',478 'export { Foo, Bar, Baz as Qux } from "x";',479 'export { Foo, Bar, Baz as Qux, } from "x";',480 'export { Foo as Bar, Baz as Qux, Norf } from "x";',481 'export { Foo as Bar, Baz as Qux, Norf, } from "x";',482 'export { Foo as Bar, Baz, Qux as Norf } from "x";',483 'export { Foo as Bar, Baz, Qux as Norf, } from "x";',484 'export { Foo, Bar as Baz, Qux as Norf } from "x";',485 'export { Foo, Bar as Baz, Qux as Norf, } from "x";',486 'export { Foo as Bar, Baz as Qux, Norf as NoMore } from "x";',487 'export { Foo as Bar, Baz as Qux, Norf as NoMore, } from "x";',488 'export Default, * as All from "x";',489 'export Default, { } from "x";',490 'export Default, { Foo } from "x";',491 'export Default, { Foo, } from "x";',492 'export Default, { Foo as Bar } from "x";',493 'export Default, { Foo as Bar, } from "x";',494 'export Default, { Foo, Bar } from "x";',495 'export Default, { Foo, Bar, } from "x";',496 'export Default, { Foo as Bar, Baz } from "x";',497 'export Default, { Foo as Bar, Baz, } from "x";',498 'export Default, { Foo, Bar as Baz } from "x";',499 'export Default, { Foo, Bar as Baz, } from "x";',500 'export Default, { Foo as Bar, Baz as Qux } from "x";',501 'export Default, { Foo as Bar, Baz as Qux, } from "x";',502 'export Default, { Foo, Bar, Baz } from "x";',503 'export Default, { Foo, Bar, Baz, } from "x";',504 'export Default, { Foo as Bar, Baz, Qux } from "x";',505 'export Default, { Foo as Bar, Baz, Qux, } from "x";',506 'export Default, { Foo, Bar as Baz, Qux } from "x";',507 'export Default, { Foo, Bar as Baz, Qux, } from "x";',508 'export Default, { Foo, Bar, Baz as Qux } from "x";',509 'export Default, { Foo, Bar, Baz as Qux, } from "x";',510 'export Default, { Foo as Bar, Baz as Qux, Norf } from "x";',511 'export Default, { Foo as Bar, Baz as Qux, Norf, } from "x";',512 'export Default, { Foo as Bar, Baz, Qux as Norf } from "x";',513 'export Default, { Foo as Bar, Baz, Qux as Norf, } from "x";',514 'export Default, { Foo, Bar as Baz, Qux as Norf } from "x";',515 'export Default, { Foo, Bar as Baz, Qux as Norf, } from "x";',516 'export Default, { Foo as Bar, Baz as Qux, Norf as Enuf } from "x";',517 'export Default, { Foo as Bar, Baz as Qux, Norf as Enuf, } from "x";',518 'export Default from "y";',519 'export * as All from \'z\';',520 // export with support for new lines521 "export { Foo,\n Bar }\n from 'x';",522 "export { \nFoo,\nBar,\n }\n from 'x';",523 "export { Foo as Bar,\n Baz\n }\n from 'x';",524 "export { \nFoo as Bar,\n Baz\n, }\n from 'x';",525 "export { Foo,\n Bar as Baz\n }\n from 'x';",526 "export { Foo,\n Bar as Baz,\n }\n from 'x';",527 "export { Foo as Bar,\n Baz as Qux\n }\n from 'x';",528 "export { Foo as Bar,\n Baz as Qux,\n }\n from 'x';",529 "export { Foo,\n Bar,\n Baz }\n from 'x';",530 "export { Foo,\n Bar,\n Baz,\n }\n from 'x';",531 "export { Foo as Bar,\n Baz,\n Qux\n }\n from 'x';",532 "export { Foo as Bar,\n Baz,\n Qux,\n }\n from 'x';",533 "export { Foo,\n Bar as Baz,\n Qux\n }\n from 'x';",534 "export { Foo,\n Bar as Baz,\n Qux,\n }\n from 'x';",535 "export { Foo,\n Bar,\n Baz as Qux\n }\n from 'x';",536 "export { Foo,\n Bar,\n Baz as Qux,\n }\n from 'x';",537 "export { Foo as Bar,\n Baz as Qux,\n Norf\n }\n from 'x';",538 "export { Foo as Bar,\n Baz as Qux,\n Norf,\n }\n from 'x';",539 "export { Foo as Bar,\n Baz,\n Qux as Norf\n }\n from 'x';",540 "export { Foo as Bar,\n Baz,\n Qux as Norf,\n }\n from 'x';",541 "export { Foo,\n Bar as Baz,\n Qux as Norf\n }\n from 'x';",542 "export { Foo,\n Bar as Baz,\n Qux as Norf,\n }\n from 'x';",543 "export { Foo as Bar,\n Baz as Qux,\n Norf as Enuf\n }\n from 'x';",544 "export { Foo as Bar,\n Baz as Qux,\n Norf as Enuf,\n }\n from 'x';",545 "export Default,\n * as All from 'x';",546 "export Default,\n { } from 'x';",547 "export Default,\n { Foo\n }\n from 'x';",548 "export Default,\n { Foo,\n }\n from 'x';",549 "export Default,\n { Foo as Bar\n }\n from 'x';",550 "export Default,\n { Foo as Bar,\n }\n from 'x';",551 "export Default,\n { Foo,\n Bar\n } from\n 'x';",552 "export Default,\n { Foo,\n Bar,\n } from\n 'x';",553 "export Default,\n { Foo as Bar,\n Baz\n }\n from 'x';",554 "export Default,\n { Foo as Bar,\n Baz,\n }\n from 'x';",555 "export Default,\n { Foo,\n Bar as Baz\n }\n from 'x';",556 "export Default,\n { Foo,\n Bar as Baz,\n }\n from 'x';",557 "export Default,\n { Foo as Bar,\n Baz as Qux\n }\n from 'x';",558 "export Default,\n { Foo as Bar,\n Baz as Qux,\n }\n from 'x';",559 "export Default,\n { Foo,\n Bar,\n Baz\n }\n from 'x';",560 "export Default,\n { Foo,\n Bar,\n Baz,\n }\n from 'x';",561 "export Default,\n { Foo as Bar,\n Baz,\n Qux\n }\n from 'x';",562 "export Default,\n { Foo as Bar,\n Baz,\n Qux,\n }\n from 'x';",563 "export Default,\n { Foo,\n Bar as Baz,\n Qux\n }\n from 'x';",564 "export Default,\n { Foo,\n Bar as Baz,\n Qux,\n }\n from 'x';",565 "export Default,\n { Foo,\n Bar,\n Baz as Qux\n }\n from 'x';",566 "export Default,\n { Foo,\n Bar,\n Baz as Qux,\n }\n from 'x';",567 "export Default,\n { Foo as Bar,\n Baz as Qux,\n Norf\n }\n from 'x';",568 "export Default,\n { Foo as Bar,\n Baz as Qux,\n Norf,\n }\n from 'x';",569 "export Default,\n { Foo as Bar,\n Baz,\n Qux as Norf }\n from 'x';",570 "export Default,\n { Foo as Bar,\n Baz,\n Qux as Norf, }\n from 'x';",571 "export Default,\n { Foo, Bar as Baz,\n Qux as Norf }\n from 'x';",572 "export Default,\n { Foo, Bar as Baz,\n Qux as Norf, }\n from 'x';",573 "export Default,\n { Foo as Bar,\n Baz as Qux,\n Norf as NoMore\n }\n from 'x';",574 "export Default,\n { Foo as Bar,\n Baz as Qux,\n Norf as NoMore,\n }\n from 'x';",575 "export Default\n , { } from 'x';",576 // require577 'require("x")',578 'require("y")',579 'require( \'z\' )',580 'require( "a")',581 'require("b" )',582 ].join('\n');583 /*eslint-disable */584 const module = createModule('test module', ['x', 'y']);585 const resolutionResponse = new ResolutionResponseMock({586 dependencies: [module],587 mainModuleId: 'test module',588 asyncDependencies: [],589 });590 resolutionResponse.getResolvedDependencyPairs = (module) => {591 return [592 ['x', createModule('changed')],593 ['y', createModule('Y')],594 ];595 }596 return depResolver.wrapModule(597 resolutionResponse,598 createModule('test module', ['x', 'y']),599 code600 ).then(processedCode => {601 expect(processedCode.name).toEqual('test module');602 expect(processedCode.code).toEqual([603 '__d(\'test module\',function(global, require,' +604 ' module, exports) { ' +605 // single line import606 "import'x';",607 "import 'changed';",608 "import 'changed' ;",609 "import Default from 'changed';",610 "import * as All from 'changed';",611 "import {} from 'changed';",612 "import { } from 'changed';",613 "import {Foo} from 'changed';",614 "import { Foo } from 'changed';",615 "import { Foo, } from 'changed';",616 "import {Foo as Bar} from 'changed';",617 "import { Foo as Bar } from 'changed';",618 "import { Foo as Bar, } from 'changed';",619 "import { Foo, Bar } from 'changed';",620 "import { Foo, Bar, } from 'changed';",621 "import { Foo as Bar, Baz } from 'changed';",622 "import { Foo as Bar, Baz, } from 'changed';",623 "import { Foo, Bar as Baz } from 'changed';",624 "import { Foo, Bar as Baz, } from 'changed';",625 "import { Foo as Bar, Baz as Qux } from 'changed';",626 "import { Foo as Bar, Baz as Qux, } from 'changed';",627 "import { Foo, Bar, Baz } from 'changed';",628 "import { Foo, Bar, Baz, } from 'changed';",629 "import { Foo as Bar, Baz, Qux } from 'changed';",630 "import { Foo as Bar, Baz, Qux, } from 'changed';",631 "import { Foo, Bar as Baz, Qux } from 'changed';",632 "import { Foo, Bar as Baz, Qux, } from 'changed';",633 "import { Foo, Bar, Baz as Qux } from 'changed';",634 "import { Foo, Bar, Baz as Qux, } from 'changed';",635 "import { Foo as Bar, Baz as Qux, Norf } from 'changed';",636 "import { Foo as Bar, Baz as Qux, Norf, } from 'changed';",637 "import { Foo as Bar, Baz, Qux as Norf } from 'changed';",638 "import { Foo as Bar, Baz, Qux as Norf, } from 'changed';",639 "import { Foo, Bar as Baz, Qux as Norf } from 'changed';",640 "import { Foo, Bar as Baz, Qux as Norf, } from 'changed';",641 "import { Foo as Bar, Baz as Qux, Norf as Enuf } from 'changed';",642 "import { Foo as Bar, Baz as Qux, Norf as Enuf, } from 'changed';",643 "import Default, * as All from 'changed';",644 "import Default, { } from 'changed';",645 "import Default, { Foo } from 'changed';",646 "import Default, { Foo, } from 'changed';",647 "import Default, { Foo as Bar } from 'changed';",648 "import Default, { Foo as Bar, } from 'changed';",649 "import Default, { Foo, Bar } from 'changed';",650 "import Default, { Foo, Bar, } from 'changed';",651 "import Default, { Foo as Bar, Baz } from 'changed';",652 "import Default, { Foo as Bar, Baz, } from 'changed';",653 "import Default, { Foo, Bar as Baz } from 'changed';",654 "import Default, { Foo, Bar as Baz, } from 'changed';",655 "import Default, { Foo as Bar, Baz as Qux } from 'changed';",656 "import Default, { Foo as Bar, Baz as Qux, } from 'changed';",657 "import Default, { Foo, Bar, Baz } from 'changed';",658 "import Default, { Foo, Bar, Baz, } from 'changed';",659 "import Default, { Foo as Bar, Baz, Qux } from 'changed';",660 "import Default, { Foo as Bar, Baz, Qux, } from 'changed';",661 "import Default, { Foo, Bar as Baz, Qux } from 'changed';",662 "import Default, { Foo, Bar as Baz, Qux, } from 'changed';",663 "import Default, { Foo, Bar, Baz as Qux } from 'changed';",664 "import Default, { Foo, Bar, Baz as Qux, } from 'changed';",665 "import Default, { Foo as Bar, Baz as Qux, Norf } from 'changed';",666 "import Default, { Foo as Bar, Baz as Qux, Norf, } from 'changed';",667 "import Default, { Foo as Bar, Baz, Qux as Norf } from 'changed';",668 "import Default, { Foo as Bar, Baz, Qux as Norf, } from 'changed';",669 "import Default, { Foo, Bar as Baz, Qux as Norf } from 'changed';",670 "import Default, { Foo, Bar as Baz, Qux as Norf, } from 'changed';",671 "import Default, { Foo as Bar, Baz as Qux, Norf as NoMore } from 'changed';",672 "import Default, { Foo as Bar, Baz as Qux, Norf as NoMore, } from 'changed';",673 "import Default , { } from 'changed';",674 'import "changed";',675 'import Default from "changed";',676 'import * as All from "changed";',677 'import { } from "changed";',678 'import { Foo } from "changed";',679 'import { Foo, } from "changed";',680 'import { Foo as Bar } from "changed";',681 'import { Foo as Bar, } from "changed";',682 'import { Foo, Bar } from "changed";',683 'import { Foo, Bar, } from "changed";',684 'import { Foo as Bar, Baz } from "changed";',685 'import { Foo as Bar, Baz, } from "changed";',686 'import { Foo, Bar as Baz } from "changed";',687 'import { Foo, Bar as Baz, } from "changed";',688 'import { Foo as Bar, Baz as Qux } from "changed";',689 'import { Foo as Bar, Baz as Qux, } from "changed";',690 'import { Foo, Bar, Baz } from "changed";',691 'import { Foo, Bar, Baz, } from "changed";',692 'import { Foo as Bar, Baz, Qux } from "changed";',693 'import { Foo as Bar, Baz, Qux, } from "changed";',694 'import { Foo, Bar as Baz, Qux } from "changed";',695 'import { Foo, Bar as Baz, Qux, } from "changed";',696 'import { Foo, Bar, Baz as Qux } from "changed";',697 'import { Foo, Bar, Baz as Qux, } from "changed";',698 'import { Foo as Bar, Baz as Qux, Norf } from "changed";',699 'import { Foo as Bar, Baz as Qux, Norf, } from "changed";',700 'import { Foo as Bar, Baz, Qux as Norf } from "changed";',701 'import { Foo as Bar, Baz, Qux as Norf, } from "changed";',702 'import { Foo, Bar as Baz, Qux as Norf } from "changed";',703 'import { Foo, Bar as Baz, Qux as Norf, } from "changed";',704 'import { Foo as Bar, Baz as Qux, Norf as NoMore } from "changed";',705 'import { Foo as Bar, Baz as Qux, Norf as NoMore, } from "changed";',706 'import Default, * as All from "changed";',707 'import Default, { } from "changed";',708 'import Default, { Foo } from "changed";',709 'import Default, { Foo, } from "changed";',710 'import Default, { Foo as Bar } from "changed";',711 'import Default, { Foo as Bar, } from "changed";',712 'import Default, { Foo, Bar } from "changed";',713 'import Default, { Foo, Bar, } from "changed";',714 'import Default, { Foo as Bar, Baz } from "changed";',715 'import Default, { Foo as Bar, Baz, } from "changed";',716 'import Default, { Foo, Bar as Baz } from "changed";',717 'import Default, { Foo, Bar as Baz, } from "changed";',718 'import Default, { Foo as Bar, Baz as Qux } from "changed";',719 'import Default, { Foo as Bar, Baz as Qux, } from "changed";',720 'import Default, { Foo, Bar, Baz } from "changed";',721 'import Default, { Foo, Bar, Baz, } from "changed";',722 'import Default, { Foo as Bar, Baz, Qux } from "changed";',723 'import Default, { Foo as Bar, Baz, Qux, } from "changed";',724 'import Default, { Foo, Bar as Baz, Qux } from "changed";',725 'import Default, { Foo, Bar as Baz, Qux, } from "changed";',726 'import Default, { Foo, Bar, Baz as Qux } from "changed";',727 'import Default, { Foo, Bar, Baz as Qux, } from "changed";',728 'import Default, { Foo as Bar, Baz as Qux, Norf } from "changed";',729 'import Default, { Foo as Bar, Baz as Qux, Norf, } from "changed";',730 'import Default, { Foo as Bar, Baz, Qux as Norf } from "changed";',731 'import Default, { Foo as Bar, Baz, Qux as Norf, } from "changed";',732 'import Default, { Foo, Bar as Baz, Qux as Norf } from "changed";',733 'import Default, { Foo, Bar as Baz, Qux as Norf, } from "changed";',734 'import Default, { Foo as Bar, Baz as Qux, Norf as Enuf } from "changed";',735 'import Default, { Foo as Bar, Baz as Qux, Norf as Enuf, } from "changed";',736 'import Default from "Y";',737 'import * as All from \'z\';',738 // import with support for new lines739 "import { Foo,\n Bar }\n from 'changed';",740 "import { \nFoo,\nBar,\n }\n from 'changed';",741 "import { Foo as Bar,\n Baz\n }\n from 'changed';",742 "import { \nFoo as Bar,\n Baz\n, }\n from 'changed';",743 "import { Foo,\n Bar as Baz\n }\n from 'changed';",744 "import { Foo,\n Bar as Baz,\n }\n from 'changed';",745 "import { Foo as Bar,\n Baz as Qux\n }\n from 'changed';",746 "import { Foo as Bar,\n Baz as Qux,\n }\n from 'changed';",747 "import { Foo,\n Bar,\n Baz }\n from 'changed';",748 "import { Foo,\n Bar,\n Baz,\n }\n from 'changed';",749 "import { Foo as Bar,\n Baz,\n Qux\n }\n from 'changed';",750 "import { Foo as Bar,\n Baz,\n Qux,\n }\n from 'changed';",751 "import { Foo,\n Bar as Baz,\n Qux\n }\n from 'changed';",752 "import { Foo,\n Bar as Baz,\n Qux,\n }\n from 'changed';",753 "import { Foo,\n Bar,\n Baz as Qux\n }\n from 'changed';",754 "import { Foo,\n Bar,\n Baz as Qux,\n }\n from 'changed';",755 "import { Foo as Bar,\n Baz as Qux,\n Norf\n }\n from 'changed';",756 "import { Foo as Bar,\n Baz as Qux,\n Norf,\n }\n from 'changed';",757 "import { Foo as Bar,\n Baz,\n Qux as Norf\n }\n from 'changed';",758 "import { Foo as Bar,\n Baz,\n Qux as Norf,\n }\n from 'changed';",759 "import { Foo,\n Bar as Baz,\n Qux as Norf\n }\n from 'changed';",760 "import { Foo,\n Bar as Baz,\n Qux as Norf,\n }\n from 'changed';",761 "import { Foo as Bar,\n Baz as Qux,\n Norf as Enuf\n }\n from 'changed';",762 "import { Foo as Bar,\n Baz as Qux,\n Norf as Enuf,\n }\n from 'changed';",763 "import Default,\n * as All from 'changed';",764 "import Default,\n { } from 'changed';",765 "import Default,\n { Foo\n }\n from 'changed';",766 "import Default,\n { Foo,\n }\n from 'changed';",767 "import Default,\n { Foo as Bar\n }\n from 'changed';",768 "import Default,\n { Foo as Bar,\n }\n from 'changed';",769 "import Default,\n { Foo,\n Bar\n } from\n 'changed';",770 "import Default,\n { Foo,\n Bar,\n } from\n 'changed';",771 "import Default,\n { Foo as Bar,\n Baz\n }\n from 'changed';",772 "import Default,\n { Foo as Bar,\n Baz,\n }\n from 'changed';",773 "import Default,\n { Foo,\n Bar as Baz\n }\n from 'changed';",774 "import Default,\n { Foo,\n Bar as Baz,\n }\n from 'changed';",775 "import Default,\n { Foo as Bar,\n Baz as Qux\n }\n from 'changed';",776 "import Default,\n { Foo as Bar,\n Baz as Qux,\n }\n from 'changed';",777 "import Default,\n { Foo,\n Bar,\n Baz\n }\n from 'changed';",778 "import Default,\n { Foo,\n Bar,\n Baz,\n }\n from 'changed';",779 "import Default,\n { Foo as Bar,\n Baz,\n Qux\n }\n from 'changed';",780 "import Default,\n { Foo as Bar,\n Baz,\n Qux,\n }\n from 'changed';",781 "import Default,\n { Foo,\n Bar as Baz,\n Qux\n }\n from 'changed';",782 "import Default,\n { Foo,\n Bar as Baz,\n Qux,\n }\n from 'changed';",783 "import Default,\n { Foo,\n Bar,\n Baz as Qux\n }\n from 'changed';",784 "import Default,\n { Foo,\n Bar,\n Baz as Qux,\n }\n from 'changed';",785 "import Default,\n { Foo as Bar,\n Baz as Qux,\n Norf\n }\n from 'changed';",786 "import Default,\n { Foo as Bar,\n Baz as Qux,\n Norf,\n }\n from 'changed';",787 "import Default,\n { Foo as Bar,\n Baz,\n Qux as Norf }\n from 'changed';",788 "import Default,\n { Foo as Bar,\n Baz,\n Qux as Norf, }\n from 'changed';",789 "import Default,\n { Foo, Bar as Baz,\n Qux as Norf }\n from 'changed';",790 "import Default,\n { Foo, Bar as Baz,\n Qux as Norf, }\n from 'changed';",791 "import Default,\n { Foo as Bar,\n Baz as Qux,\n Norf as NoMore\n }\n from 'changed';",792 "import Default,\n { Foo as Bar,\n Baz as Qux,\n Norf as NoMore,\n }\n from 'changed';",793 "import Default\n , { } from 'changed';",794 // single line export795 "export'x';",796 "export 'changed';",797 "export 'changed' ;",798 "export Default from 'changed';",799 "export * as All from 'changed';",800 "export {} from 'changed';",801 "export { } from 'changed';",802 "export {Foo} from 'changed';",803 "export { Foo } from 'changed';",804 "export { Foo, } from 'changed';",805 "export {Foo as Bar} from 'changed';",806 "export { Foo as Bar } from 'changed';",807 "export { Foo as Bar, } from 'changed';",808 "export { Foo, Bar } from 'changed';",809 "export { Foo, Bar, } from 'changed';",810 "export { Foo as Bar, Baz } from 'changed';",811 "export { Foo as Bar, Baz, } from 'changed';",812 "export { Foo, Bar as Baz } from 'changed';",813 "export { Foo, Bar as Baz, } from 'changed';",814 "export { Foo as Bar, Baz as Qux } from 'changed';",815 "export { Foo as Bar, Baz as Qux, } from 'changed';",816 "export { Foo, Bar, Baz } from 'changed';",817 "export { Foo, Bar, Baz, } from 'changed';",818 "export { Foo as Bar, Baz, Qux } from 'changed';",819 "export { Foo as Bar, Baz, Qux, } from 'changed';",820 "export { Foo, Bar as Baz, Qux } from 'changed';",821 "export { Foo, Bar as Baz, Qux, } from 'changed';",822 "export { Foo, Bar, Baz as Qux } from 'changed';",823 "export { Foo, Bar, Baz as Qux, } from 'changed';",824 "export { Foo as Bar, Baz as Qux, Norf } from 'changed';",825 "export { Foo as Bar, Baz as Qux, Norf, } from 'changed';",826 "export { Foo as Bar, Baz, Qux as Norf } from 'changed';",827 "export { Foo as Bar, Baz, Qux as Norf, } from 'changed';",828 "export { Foo, Bar as Baz, Qux as Norf } from 'changed';",829 "export { Foo, Bar as Baz, Qux as Norf, } from 'changed';",830 "export { Foo as Bar, Baz as Qux, Norf as Enuf } from 'changed';",831 "export { Foo as Bar, Baz as Qux, Norf as Enuf, } from 'changed';",832 "export Default, * as All from 'changed';",833 "export Default, { } from 'changed';",834 "export Default, { Foo } from 'changed';",835 "export Default, { Foo, } from 'changed';",836 "export Default, { Foo as Bar } from 'changed';",837 "export Default, { Foo as Bar, } from 'changed';",838 "export Default, { Foo, Bar } from 'changed';",839 "export Default, { Foo, Bar, } from 'changed';",840 "export Default, { Foo as Bar, Baz } from 'changed';",841 "export Default, { Foo as Bar, Baz, } from 'changed';",842 "export Default, { Foo, Bar as Baz } from 'changed';",843 "export Default, { Foo, Bar as Baz, } from 'changed';",844 "export Default, { Foo as Bar, Baz as Qux } from 'changed';",845 "export Default, { Foo as Bar, Baz as Qux, } from 'changed';",846 "export Default, { Foo, Bar, Baz } from 'changed';",847 "export Default, { Foo, Bar, Baz, } from 'changed';",848 "export Default, { Foo as Bar, Baz, Qux } from 'changed';",849 "export Default, { Foo as Bar, Baz, Qux, } from 'changed';",850 "export Default, { Foo, Bar as Baz, Qux } from 'changed';",851 "export Default, { Foo, Bar as Baz, Qux, } from 'changed';",852 "export Default, { Foo, Bar, Baz as Qux } from 'changed';",853 "export Default, { Foo, Bar, Baz as Qux, } from 'changed';",854 "export Default, { Foo as Bar, Baz as Qux, Norf } from 'changed';",855 "export Default, { Foo as Bar, Baz as Qux, Norf, } from 'changed';",856 "export Default, { Foo as Bar, Baz, Qux as Norf } from 'changed';",857 "export Default, { Foo as Bar, Baz, Qux as Norf, } from 'changed';",858 "export Default, { Foo, Bar as Baz, Qux as Norf } from 'changed';",859 "export Default, { Foo, Bar as Baz, Qux as Norf, } from 'changed';",860 "export Default, { Foo as Bar, Baz as Qux, Norf as NoMore } from 'changed';",861 "export Default, { Foo as Bar, Baz as Qux, Norf as NoMore, } from 'changed';",862 "export Default , { } from 'changed';",863 'export "changed";',864 'export Default from "changed";',865 'export * as All from "changed";',866 'export { } from "changed";',867 'export { Foo } from "changed";',868 'export { Foo, } from "changed";',869 'export { Foo as Bar } from "changed";',870 'export { Foo as Bar, } from "changed";',871 'export { Foo, Bar } from "changed";',872 'export { Foo, Bar, } from "changed";',873 'export { Foo as Bar, Baz } from "changed";',874 'export { Foo as Bar, Baz, } from "changed";',875 'export { Foo, Bar as Baz } from "changed";',876 'export { Foo, Bar as Baz, } from "changed";',877 'export { Foo as Bar, Baz as Qux } from "changed";',878 'export { Foo as Bar, Baz as Qux, } from "changed";',879 'export { Foo, Bar, Baz } from "changed";',880 'export { Foo, Bar, Baz, } from "changed";',881 'export { Foo as Bar, Baz, Qux } from "changed";',882 'export { Foo as Bar, Baz, Qux, } from "changed";',883 'export { Foo, Bar as Baz, Qux } from "changed";',884 'export { Foo, Bar as Baz, Qux, } from "changed";',885 'export { Foo, Bar, Baz as Qux } from "changed";',886 'export { Foo, Bar, Baz as Qux, } from "changed";',887 'export { Foo as Bar, Baz as Qux, Norf } from "changed";',888 'export { Foo as Bar, Baz as Qux, Norf, } from "changed";',889 'export { Foo as Bar, Baz, Qux as Norf } from "changed";',890 'export { Foo as Bar, Baz, Qux as Norf, } from "changed";',891 'export { Foo, Bar as Baz, Qux as Norf } from "changed";',892 'export { Foo, Bar as Baz, Qux as Norf, } from "changed";',893 'export { Foo as Bar, Baz as Qux, Norf as NoMore } from "changed";',894 'export { Foo as Bar, Baz as Qux, Norf as NoMore, } from "changed";',895 'export Default, * as All from "changed";',896 'export Default, { } from "changed";',897 'export Default, { Foo } from "changed";',898 'export Default, { Foo, } from "changed";',899 'export Default, { Foo as Bar } from "changed";',900 'export Default, { Foo as Bar, } from "changed";',901 'export Default, { Foo, Bar } from "changed";',902 'export Default, { Foo, Bar, } from "changed";',903 'export Default, { Foo as Bar, Baz } from "changed";',904 'export Default, { Foo as Bar, Baz, } from "changed";',905 'export Default, { Foo, Bar as Baz } from "changed";',906 'export Default, { Foo, Bar as Baz, } from "changed";',907 'export Default, { Foo as Bar, Baz as Qux } from "changed";',908 'export Default, { Foo as Bar, Baz as Qux, } from "changed";',909 'export Default, { Foo, Bar, Baz } from "changed";',910 'export Default, { Foo, Bar, Baz, } from "changed";',911 'export Default, { Foo as Bar, Baz, Qux } from "changed";',912 'export Default, { Foo as Bar, Baz, Qux, } from "changed";',913 'export Default, { Foo, Bar as Baz, Qux } from "changed";',914 'export Default, { Foo, Bar as Baz, Qux, } from "changed";',915 'export Default, { Foo, Bar, Baz as Qux } from "changed";',916 'export Default, { Foo, Bar, Baz as Qux, } from "changed";',917 'export Default, { Foo as Bar, Baz as Qux, Norf } from "changed";',918 'export Default, { Foo as Bar, Baz as Qux, Norf, } from "changed";',919 'export Default, { Foo as Bar, Baz, Qux as Norf } from "changed";',920 'export Default, { Foo as Bar, Baz, Qux as Norf, } from "changed";',921 'export Default, { Foo, Bar as Baz, Qux as Norf } from "changed";',922 'export Default, { Foo, Bar as Baz, Qux as Norf, } from "changed";',923 'export Default, { Foo as Bar, Baz as Qux, Norf as Enuf } from "changed";',924 'export Default, { Foo as Bar, Baz as Qux, Norf as Enuf, } from "changed";',925 'export Default from "Y";',926 'export * as All from \'z\';',927 // export with support for new lines928 "export { Foo,\n Bar }\n from 'changed';",929 "export { \nFoo,\nBar,\n }\n from 'changed';",930 "export { Foo as Bar,\n Baz\n }\n from 'changed';",931 "export { \nFoo as Bar,\n Baz\n, }\n from 'changed';",932 "export { Foo,\n Bar as Baz\n }\n from 'changed';",933 "export { Foo,\n Bar as Baz,\n }\n from 'changed';",934 "export { Foo as Bar,\n Baz as Qux\n }\n from 'changed';",935 "export { Foo as Bar,\n Baz as Qux,\n }\n from 'changed';",936 "export { Foo,\n Bar,\n Baz }\n from 'changed';",937 "export { Foo,\n Bar,\n Baz,\n }\n from 'changed';",938 "export { Foo as Bar,\n Baz,\n Qux\n }\n from 'changed';",939 "export { Foo as Bar,\n Baz,\n Qux,\n }\n from 'changed';",940 "export { Foo,\n Bar as Baz,\n Qux\n }\n from 'changed';",941 "export { Foo,\n Bar as Baz,\n Qux,\n }\n from 'changed';",942 "export { Foo,\n Bar,\n Baz as Qux\n }\n from 'changed';",943 "export { Foo,\n Bar,\n Baz as Qux,\n }\n from 'changed';",944 "export { Foo as Bar,\n Baz as Qux,\n Norf\n }\n from 'changed';",945 "export { Foo as Bar,\n Baz as Qux,\n Norf,\n }\n from 'changed';",946 "export { Foo as Bar,\n Baz,\n Qux as Norf\n }\n from 'changed';",947 "export { Foo as Bar,\n Baz,\n Qux as Norf,\n }\n from 'changed';",948 "export { Foo,\n Bar as Baz,\n Qux as Norf\n }\n from 'changed';",949 "export { Foo,\n Bar as Baz,\n Qux as Norf,\n }\n from 'changed';",950 "export { Foo as Bar,\n Baz as Qux,\n Norf as Enuf\n }\n from 'changed';",951 "export { Foo as Bar,\n Baz as Qux,\n Norf as Enuf,\n }\n from 'changed';",952 "export Default,\n * as All from 'changed';",953 "export Default,\n { } from 'changed';",954 "export Default,\n { Foo\n }\n from 'changed';",955 "export Default,\n { Foo,\n }\n from 'changed';",956 "export Default,\n { Foo as Bar\n }\n from 'changed';",957 "export Default,\n { Foo as Bar,\n }\n from 'changed';",958 "export Default,\n { Foo,\n Bar\n } from\n 'changed';",959 "export Default,\n { Foo,\n Bar,\n } from\n 'changed';",960 "export Default,\n { Foo as Bar,\n Baz\n }\n from 'changed';",961 "export Default,\n { Foo as Bar,\n Baz,\n }\n from 'changed';",962 "export Default,\n { Foo,\n Bar as Baz\n }\n from 'changed';",963 "export Default,\n { Foo,\n Bar as Baz,\n }\n from 'changed';",964 "export Default,\n { Foo as Bar,\n Baz as Qux\n }\n from 'changed';",965 "export Default,\n { Foo as Bar,\n Baz as Qux,\n }\n from 'changed';",966 "export Default,\n { Foo,\n Bar,\n Baz\n }\n from 'changed';",967 "export Default,\n { Foo,\n Bar,\n Baz,\n }\n from 'changed';",968 "export Default,\n { Foo as Bar,\n Baz,\n Qux\n }\n from 'changed';",969 "export Default,\n { Foo as Bar,\n Baz,\n Qux,\n }\n from 'changed';",970 "export Default,\n { Foo,\n Bar as Baz,\n Qux\n }\n from 'changed';",971 "export Default,\n { Foo,\n Bar as Baz,\n Qux,\n }\n from 'changed';",972 "export Default,\n { Foo,\n Bar,\n Baz as Qux\n }\n from 'changed';",973 "export Default,\n { Foo,\n Bar,\n Baz as Qux,\n }\n from 'changed';",974 "export Default,\n { Foo as Bar,\n Baz as Qux,\n Norf\n }\n from 'changed';",975 "export Default,\n { Foo as Bar,\n Baz as Qux,\n Norf,\n }\n from 'changed';",976 "export Default,\n { Foo as Bar,\n Baz,\n Qux as Norf }\n from 'changed';",977 "export Default,\n { Foo as Bar,\n Baz,\n Qux as Norf, }\n from 'changed';",978 "export Default,\n { Foo, Bar as Baz,\n Qux as Norf }\n from 'changed';",979 "export Default,\n { Foo, Bar as Baz,\n Qux as Norf, }\n from 'changed';",980 "export Default,\n { Foo as Bar,\n Baz as Qux,\n Norf as NoMore\n }\n from 'changed';",981 "export Default,\n { Foo as Bar,\n Baz as Qux,\n Norf as NoMore,\n }\n from 'changed';",982 "export Default\n , { } from 'changed';",983 // require984 'require("changed")',985 'require("Y")',986 'require( \'z\' )',987 'require( "a")',988 'require("b" )',989 '});',990 ].join('\n'));991 });992 });993 });...

Full Screen

Full Screen

duration.js

Source:duration.js Github

copy

Full Screen

...451 ds = moment.duration(3, 'seconds'),452 dm = moment.duration(13, 'minutes');453 // Tests for issue #1867.454 // Floating point errors for small duration units were introduced in version 2.8.0.455 assert.equal(dS.as('milliseconds'), 1, 'as("milliseconds")');456 assert.equal(dS.asMilliseconds(), 1, 'asMilliseconds()');457 assert.equal(ds.as('seconds'), 3, 'as("seconds")');458 assert.equal(ds.asSeconds(), 3, 'asSeconds()');459 assert.equal(dm.as('minutes'), 13, 'as("minutes")');460 assert.equal(dm.asMinutes(), 13, 'asMinutes()');461});462test('isDuration', function (assert) {463 assert.ok(moment.isDuration(moment.duration(12345678)), 'correctly says true');464 assert.ok(!moment.isDuration(moment()), 'moment object is not a duration');465 assert.ok(!moment.isDuration({milliseconds: 1}), 'plain object is not a duration');466});467test('add', function (assert) {468 var d = moment.duration({months: 4, weeks: 3, days: 2});469 // for some reason, d._data._months does not get updated; use d._months instead.470 assert.equal(d.add(1, 'month')._months, 5, 'Add months');471 assert.equal(d.add(5, 'days')._days, 28, 'Add days');472 assert.equal(d.add(10000)._milliseconds, 10000, 'Add milliseconds');473 assert.equal(d.add({h: 23, m: 59})._milliseconds, 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 10000, 'Add hour:minute');...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1// Addons2export { default as Confirm } from './addons/Confirm'3export { default as Pagination } from './addons/Pagination'4export { default as PaginationItem } from './addons/Pagination/PaginationItem'5export { default as Portal } from './addons/Portal'6export { default as Radio } from './addons/Radio'7export { default as Ref } from './addons/Ref'8export { default as Responsive } from './addons/Responsive'9export { default as Select } from './addons/Select'10export { default as TextArea } from './addons/TextArea'11export { default as TransitionablePortal } from './addons/TransitionablePortal'12// Behaviors13export { default as Visibility } from './behaviors/Visibility'14// Collections15export { default as Breadcrumb } from './collections/Breadcrumb'16export { default as BreadcrumbDivider } from './collections/Breadcrumb/BreadcrumbDivider'17export { default as BreadcrumbSection } from './collections/Breadcrumb/BreadcrumbSection'18export { default as Form } from './collections/Form'19export { default as FormButton } from './collections/Form/FormButton'20export { default as FormCheckbox } from './collections/Form/FormCheckbox'21export { default as FormDropdown } from './collections/Form/FormDropdown'22export { default as FormField } from './collections/Form/FormField'23export { default as FormGroup } from './collections/Form/FormGroup'24export { default as FormInput } from './collections/Form/FormInput'25export { default as FormRadio } from './collections/Form/FormRadio'26export { default as FormSelect } from './collections/Form/FormSelect'27export { default as FormTextArea } from './collections/Form/FormTextArea'28export { default as Grid } from './collections/Grid'29export { default as GridColumn } from './collections/Grid/GridColumn'30export { default as GridRow } from './collections/Grid/GridRow'31export { default as Menu } from './collections/Menu'32export { default as MenuHeader } from './collections/Menu/MenuHeader'33export { default as MenuItem } from './collections/Menu/MenuItem'34export { default as MenuMenu } from './collections/Menu/MenuMenu'35export { default as Message } from './collections/Message'36export { default as MessageContent } from './collections/Message/MessageContent'37export { default as MessageHeader } from './collections/Message/MessageHeader'38export { default as MessageItem } from './collections/Message/MessageItem'39export { default as MessageList } from './collections/Message/MessageList'40export { default as Table } from './collections/Table'41export { default as TableBody } from './collections/Table/TableBody'42export { default as TableCell } from './collections/Table/TableCell'43export { default as TableFooter } from './collections/Table/TableFooter'44export { default as TableHeader } from './collections/Table/TableHeader'45export { default as TableHeaderCell } from './collections/Table/TableHeaderCell'46export { default as TableRow } from './collections/Table/TableRow'47// Elements48export { default as Button } from './elements/Button/Button'49export { default as ButtonContent } from './elements/Button/ButtonContent'50export { default as ButtonGroup } from './elements/Button/ButtonGroup'51export { default as ButtonOr } from './elements/Button/ButtonOr'52export { default as Container } from './elements/Container'53export { default as Divider } from './elements/Divider'54export { default as Flag } from './elements/Flag'55export { default as Header } from './elements/Header'56export { default as HeaderContent } from './elements/Header/HeaderContent'57export { default as HeaderSubheader } from './elements/Header/HeaderSubheader'58export { default as Icon } from './elements/Icon'59export { default as IconGroup } from './elements/Icon/IconGroup'60export { default as Image } from './elements/Image'61export { default as ImageGroup } from './elements/Image/ImageGroup'62export { default as Input } from './elements/Input'63export { default as Label } from './elements/Label'64export { default as LabelDetail } from './elements/Label/LabelDetail'65export { default as LabelGroup } from './elements/Label/LabelGroup'66export { default as List } from './elements/List'67export { default as ListContent } from './elements/List/ListContent'68export { default as ListDescription } from './elements/List/ListDescription'69export { default as ListHeader } from './elements/List/ListHeader'70export { default as ListIcon } from './elements/List/ListIcon'71export { default as ListItem } from './elements/List/ListItem'72export { default as ListList } from './elements/List/ListList'73export { default as Loader } from './elements/Loader'74export { default as Rail } from './elements/Rail'75export { default as Reveal } from './elements/Reveal'76export { default as RevealContent } from './elements/Reveal/RevealContent'77export { default as Segment } from './elements/Segment'78export { default as SegmentGroup } from './elements/Segment/SegmentGroup'79export { default as Step } from './elements/Step'80export { default as StepContent } from './elements/Step/StepContent'81export { default as StepDescription } from './elements/Step/StepDescription'82export { default as StepGroup } from './elements/Step/StepGroup'83export { default as StepTitle } from './elements/Step/StepTitle'84// Modules85export { default as Accordion } from './modules/Accordion/Accordion'86export { default as AccordionAccordion } from './modules/Accordion/AccordionAccordion'87export { default as AccordionContent } from './modules/Accordion/AccordionContent'88export { default as AccordionTitle } from './modules/Accordion/AccordionTitle'89export { default as Checkbox } from './modules/Checkbox'90export { default as Dimmer } from './modules/Dimmer'91export { default as DimmerDimmable } from './modules/Dimmer/DimmerDimmable'92export { default as Dropdown } from './modules/Dropdown'93export { default as DropdownDivider } from './modules/Dropdown/DropdownDivider'94export { default as DropdownHeader } from './modules/Dropdown/DropdownHeader'95export { default as DropdownItem } from './modules/Dropdown/DropdownItem'96export { default as DropdownMenu } from './modules/Dropdown/DropdownMenu'97export { default as DropdownSearchInput } from './modules/Dropdown/DropdownSearchInput'98export { default as Embed } from './modules/Embed'99export { default as Modal } from './modules/Modal'100export { default as ModalActions } from './modules/Modal/ModalActions'101export { default as ModalContent } from './modules/Modal/ModalContent'102export { default as ModalDescription } from './modules/Modal/ModalDescription'103export { default as ModalHeader } from './modules/Modal/ModalHeader'104export { default as Popup } from './modules/Popup'105export { default as PopupContent } from './modules/Popup/PopupContent'106export { default as PopupHeader } from './modules/Popup/PopupHeader'107export { default as Progress } from './modules/Progress'108export { default as Rating } from './modules/Rating'109export { default as RatingIcon } from './modules/Rating/RatingIcon'110export { default as Search } from './modules/Search'111export { default as SearchCategory } from './modules/Search/SearchCategory'112export { default as SearchResult } from './modules/Search/SearchResult'113export { default as SearchResults } from './modules/Search/SearchResults'114export { default as Sidebar } from './modules/Sidebar'115export { default as SidebarPushable } from './modules/Sidebar/SidebarPushable'116export { default as SidebarPusher } from './modules/Sidebar/SidebarPusher'117export { default as Sticky } from './modules/Sticky'118export { default as Tab } from './modules/Tab'119export { default as TabPane } from './modules/Tab/TabPane'120export { default as Transition } from './modules/Transition'121export { default as TransitionGroup } from './modules/Transition/TransitionGroup'122// Views123export { default as Advertisement } from './views/Advertisement'124export { default as Card } from './views/Card/Card'125export { default as CardContent } from './views/Card/CardContent'126export { default as CardDescription } from './views/Card/CardDescription'127export { default as CardGroup } from './views/Card/CardGroup'128export { default as CardHeader } from './views/Card/CardHeader'129export { default as CardMeta } from './views/Card/CardMeta'130export { default as Comment } from './views/Comment'131export { default as CommentAction } from './views/Comment/CommentAction'132export { default as CommentActions } from './views/Comment/CommentActions'133export { default as CommentAuthor } from './views/Comment/CommentAuthor'134export { default as CommentAvatar } from './views/Comment/CommentAvatar'135export { default as CommentContent } from './views/Comment/CommentContent'136export { default as CommentGroup } from './views/Comment/CommentGroup'137export { default as CommentMetadata } from './views/Comment/CommentMetadata'138export { default as CommentText } from './views/Comment/CommentText'139export { default as Feed } from './views/Feed'140export { default as FeedContent } from './views/Feed/FeedContent'141export { default as FeedDate } from './views/Feed/FeedDate'142export { default as FeedEvent } from './views/Feed/FeedEvent'143export { default as FeedExtra } from './views/Feed/FeedExtra'144export { default as FeedLabel } from './views/Feed/FeedLabel'145export { default as FeedLike } from './views/Feed/FeedLike'146export { default as FeedMeta } from './views/Feed/FeedMeta'147export { default as FeedSummary } from './views/Feed/FeedSummary'148export { default as FeedUser } from './views/Feed/FeedUser'149export { default as Item } from './views/Item'150export { default as ItemContent } from './views/Item/ItemContent'151export { default as ItemDescription } from './views/Item/ItemDescription'152export { default as ItemExtra } from './views/Item/ItemExtra'153export { default as ItemGroup } from './views/Item/ItemGroup'154export { default as ItemHeader } from './views/Item/ItemHeader'155export { default as ItemImage } from './views/Item/ItemImage'156export { default as ItemMeta } from './views/Item/ItemMeta'157export { default as Statistic } from './views/Statistic'158export { default as StatisticGroup } from './views/Statistic/StatisticGroup'159export { default as StatisticLabel } from './views/Statistic/StatisticLabel'...

Full Screen

Full Screen

20210225081423_country_grids.js

Source:20210225081423_country_grids.js Github

copy

Full Screen

1exports.up = async function (knex) {2 await knex.raw(3 "UPDATE states SET boundaries = st_collectionextract(st_makevalid(boundaries::geometry), 3)::geography WHERE st_isvalid(boundaries::geometry) = false"4 );5 await knex.raw("DROP MATERIALIZED VIEW country_grid_75km");6 // Suitable for 50 mile radius searches.7 await knex.raw(`8 CREATE MATERIALIZED VIEW country_grid_110km9 AS10 WITH11 country_boundary AS (12 SELECT st_union(boundaries::geometry) AS geom13 FROM states14 ),15 country_grid AS (16 SELECT make_rect_grid(geom, 110000, 110000) AS geom17 FROM country_boundary18 ),19 country_grid_rows AS (20 SELECT (st_dump(geom)).geom21 FROM country_grid22 )23 SELECT24 row_number() OVER () AS id,25 country_grid_rows.geom,26 centroid_geom::geography AS centroid_location,27 nearest_postal_code.postal_code AS centroid_postal_code,28 nearest_postal_code.state_code AS centroid_postal_code_state_code,29 nearest_postal_code.city AS centroid_postal_code_city,30 nearest_postal_code.county_name AS centroid_postal_code_county,31 nearest_postal_code.location AS centroid_postal_code_location,32 CASE WHEN st_intersects(centroid_geom, country_boundary.geom) THEN centroid_geom ELSE nearest_postal_code.location END AS centroid_land_location33 FROM country_grid_rows,34 country_boundary,35 st_centroid(country_grid_rows.geom) AS centroid_geom36 CROSS JOIN LATERAL (37 SELECT *38 FROM postal_codes39 ORDER BY location <-> centroid_geom::geography40 LIMIT 141 ) nearest_postal_code42 WHERE st_area(country_grid_rows.geom) < 543 WITH DATA;44 `);45 await knex.raw(`46 CREATE MATERIALIZED VIEW state_grid_110km47 AS48 WITH49 country_boundary AS (50 SELECT st_union(boundaries::geometry) AS geom51 FROM states52 ),53 country_grid AS (54 SELECT make_rect_grid(geom, 110000, 110000) AS geom55 FROM country_boundary56 ),57 country_grid_rows AS (58 SELECT (st_dump(geom)).geom59 FROM country_grid60 ),61 state_grid_rows AS (62 SELECT63 ST_Intersection(country_grid_rows.geom, states.boundaries::geometry) AS geom,64 states.code AS state_code65 FROM country_grid_rows66 INNER JOIN states ON ST_Intersects(country_grid_rows.geom, states.boundaries::geometry)67 )68 SELECT69 row_number() OVER () AS id,70 state_grid_rows.state_code,71 state_grid_rows.geom,72 centroid_geom::geography AS centroid_location,73 nearest_postal_code.postal_code AS centroid_postal_code,74 nearest_postal_code.state_code AS centroid_postal_code_state_code,75 nearest_postal_code.city AS centroid_postal_code_city,76 nearest_postal_code.county_name AS centroid_postal_code_county,77 nearest_postal_code.location AS centroid_postal_code_location,78 CASE WHEN st_intersects(centroid_geom, country_boundary.geom) THEN centroid_geom ELSE nearest_postal_code.location END AS centroid_land_location79 FROM state_grid_rows,80 country_boundary,81 st_centroid(state_grid_rows.geom) AS centroid_geom82 CROSS JOIN LATERAL (83 SELECT *84 FROM postal_codes85 ORDER BY location <-> centroid_geom::geography86 LIMIT 187 ) nearest_postal_code88 WHERE st_area(state_grid_rows.geom) < 589 WITH DATA;90 `);91 // Suitable for 25 mile radius searches.92 await knex.raw(`93 CREATE MATERIALIZED VIEW country_grid_55km94 AS95 WITH96 country_boundary AS (97 SELECT st_union(boundaries::geometry) AS geom98 FROM states99 ),100 country_grid AS (101 SELECT make_rect_grid(geom, 55000, 55000) AS geom102 FROM country_boundary103 ),104 country_grid_rows AS (105 SELECT (st_dump(geom)).geom106 FROM country_grid107 )108 SELECT109 row_number() OVER () AS id,110 country_grid_rows.geom,111 centroid_geom::geography AS centroid_location,112 nearest_postal_code.postal_code AS centroid_postal_code,113 nearest_postal_code.state_code AS centroid_postal_code_state_code,114 nearest_postal_code.city AS centroid_postal_code_city,115 nearest_postal_code.county_name AS centroid_postal_code_county,116 nearest_postal_code.location AS centroid_postal_code_location,117 CASE WHEN st_intersects(centroid_geom, country_boundary.geom) THEN centroid_geom ELSE nearest_postal_code.location END AS centroid_land_location118 FROM country_grid_rows,119 country_boundary,120 st_centroid(country_grid_rows.geom) AS centroid_geom121 CROSS JOIN LATERAL (122 SELECT *123 FROM postal_codes124 ORDER BY location <-> centroid_geom::geography125 LIMIT 1126 ) nearest_postal_code127 WHERE st_area(country_grid_rows.geom) < 5128 WITH DATA;129 `);130 await knex.raw(`131 CREATE MATERIALIZED VIEW state_grid_55km132 AS133 WITH134 country_boundary AS (135 SELECT st_union(boundaries::geometry) AS geom136 FROM states137 ),138 country_grid AS (139 SELECT make_rect_grid(geom, 55000, 55000) AS geom140 FROM country_boundary141 ),142 country_grid_rows AS (143 SELECT (st_dump(geom)).geom144 FROM country_grid145 ),146 state_grid_rows AS (147 SELECT148 ST_Intersection(country_grid_rows.geom, states.boundaries::geometry) AS geom,149 states.code AS state_code150 FROM country_grid_rows151 INNER JOIN states ON ST_Intersects(country_grid_rows.geom, states.boundaries::geometry)152 )153 SELECT154 row_number() OVER () AS id,155 state_grid_rows.state_code,156 state_grid_rows.geom,157 centroid_geom::geography AS centroid_location,158 nearest_postal_code.postal_code AS centroid_postal_code,159 nearest_postal_code.state_code AS centroid_postal_code_state_code,160 nearest_postal_code.city AS centroid_postal_code_city,161 nearest_postal_code.county_name AS centroid_postal_code_county,162 nearest_postal_code.location AS centroid_postal_code_location,163 CASE WHEN st_intersects(centroid_geom, country_boundary.geom) THEN centroid_geom ELSE nearest_postal_code.location END AS centroid_land_location164 FROM state_grid_rows,165 country_boundary,166 st_centroid(state_grid_rows.geom) AS centroid_geom167 CROSS JOIN LATERAL (168 SELECT *169 FROM postal_codes170 ORDER BY location <-> centroid_geom::geography171 LIMIT 1172 ) nearest_postal_code173 WHERE st_area(state_grid_rows.geom) < 5174 WITH DATA;175 `);176 await knex.schema.table("country_grid_110km", (table) => {177 table.index("geom", null, "gist");178 table.index("centroid_location", null, "gist");179 });180 await knex.schema.table("state_grid_110km", (table) => {181 table.index("geom", null, "gist");182 table.index("centroid_location", null, "gist");183 });184 await knex.schema.table("country_grid_55km", (table) => {185 table.index("geom", null, "gist");186 table.index("centroid_location", null, "gist");187 });188 await knex.schema.table("state_grid_55km", (table) => {189 table.index("geom", null, "gist");190 table.index("centroid_location", null, "gist");191 });192 await knex.schema.table("stores", (table) => {193 table.index("location", null, "gist");194 });195};196exports.down = async function (knex) {197 await knex.schema.table("stores", (table) => {198 table.dropIndex("location");199 });200 await knex.raw("DROP MATERIALIZED VIEW country_grid_110km");201 await knex.raw("DROP MATERIALIZED VIEW state_grid_110km");202 await knex.raw("DROP MATERIALIZED VIEW country_grid_55km");203 await knex.raw("DROP MATERIALIZED VIEW state_grid_55km");204 await knex.raw(`205 CREATE MATERIALIZED VIEW country_grid_75km206 AS207 WITH208 country_boundary AS (209 SELECT st_union(boundaries::geometry) AS geom210 FROM states211 ),212 country_grid AS (213 SELECT make_rect_grid(geom, 75000, 75000) AS geom214 FROM country_boundary215 ),216 country_grid_rows AS (217 SELECT (st_dump(geom)).geom218 FROM country_grid219 )220 SELECT221 geom,222 centroid_geom::geography AS centroid_location,223 nearest_postal_code.postal_code AS centroid_postal_code,224 nearest_postal_code.state_code AS centroid_postal_code_state_code,225 nearest_postal_code.city AS centroid_postal_code_city,226 nearest_postal_code.county_name AS centroid_postal_code_county,227 nearest_postal_code.location AS centroid_postal_code_location228 FROM country_grid_rows,229 st_centroid(geom) AS centroid_geom230 CROSS JOIN LATERAL (231 SELECT *232 FROM postal_codes233 ORDER BY location <-> centroid_geom::geography234 LIMIT 1235 ) nearest_postal_code236 WHERE st_area(geom) < 5237 WITH DATA;238 `);...

Full Screen

Full Screen

20210301091717_smaller_country_grids.js

Source:20210301091717_smaller_country_grids.js Github

copy

Full Screen

1exports.up = async function (knex) {2 // Suitable for 10 mile radius searches.3 await knex.raw(`4 CREATE MATERIALIZED VIEW country_grid_22km5 AS6 WITH7 country_boundary AS (8 SELECT st_union(boundaries::geometry) AS geom9 FROM states10 ),11 country_grid AS (12 SELECT make_rect_grid(geom, 22000, 22000) AS geom13 FROM country_boundary14 ),15 country_grid_rows AS (16 SELECT (st_dump(geom)).geom17 FROM country_grid18 )19 SELECT20 row_number() OVER () AS id,21 country_grid_rows.geom,22 centroid_geom::geography AS centroid_location,23 nearest_postal_code.postal_code AS centroid_postal_code,24 nearest_postal_code.state_code AS centroid_postal_code_state_code,25 nearest_postal_code.city AS centroid_postal_code_city,26 nearest_postal_code.county_name AS centroid_postal_code_county,27 nearest_postal_code.location AS centroid_postal_code_location,28 CASE WHEN st_intersects(centroid_geom, country_boundary.geom) THEN centroid_geom ELSE nearest_postal_code.location END AS centroid_land_location29 FROM country_grid_rows,30 country_boundary,31 st_centroid(country_grid_rows.geom) AS centroid_geom32 CROSS JOIN LATERAL (33 SELECT *34 FROM postal_codes35 ORDER BY location <-> centroid_geom::geography36 LIMIT 137 ) nearest_postal_code38 WHERE st_area(country_grid_rows.geom) < 539 WITH DATA;40 `);41 await knex.raw(`42 CREATE MATERIALIZED VIEW state_grid_22km43 AS44 WITH45 country_boundary AS (46 SELECT st_union(boundaries::geometry) AS geom47 FROM states48 ),49 country_grid AS (50 SELECT make_rect_grid(geom, 22000, 22000) AS geom51 FROM country_boundary52 ),53 country_grid_rows AS (54 SELECT (st_dump(geom)).geom55 FROM country_grid56 ),57 state_grid_rows AS (58 SELECT59 ST_Intersection(country_grid_rows.geom, states.boundaries::geometry) AS geom,60 states.code AS state_code61 FROM country_grid_rows62 INNER JOIN states ON ST_Intersects(country_grid_rows.geom, states.boundaries::geometry)63 )64 SELECT65 row_number() OVER () AS id,66 state_grid_rows.state_code,67 state_grid_rows.geom,68 centroid_geom::geography AS centroid_location,69 nearest_postal_code.postal_code AS centroid_postal_code,70 nearest_postal_code.state_code AS centroid_postal_code_state_code,71 nearest_postal_code.city AS centroid_postal_code_city,72 nearest_postal_code.county_name AS centroid_postal_code_county,73 nearest_postal_code.location AS centroid_postal_code_location,74 CASE WHEN st_intersects(centroid_geom, country_boundary.geom) THEN centroid_geom ELSE nearest_postal_code.location END AS centroid_land_location75 FROM state_grid_rows,76 country_boundary,77 st_centroid(state_grid_rows.geom) AS centroid_geom78 CROSS JOIN LATERAL (79 SELECT *80 FROM postal_codes81 ORDER BY location <-> centroid_geom::geography82 LIMIT 183 ) nearest_postal_code84 WHERE st_area(state_grid_rows.geom) < 585 WITH DATA;86 `);87 // Suitable for 5 mile radius searches.88 await knex.raw(`89 CREATE MATERIALIZED VIEW country_grid_11km90 AS91 WITH92 country_boundary AS (93 SELECT st_union(boundaries::geometry) AS geom94 FROM states95 ),96 country_grid AS (97 SELECT make_rect_grid(geom, 11000, 11000) AS geom98 FROM country_boundary99 ),100 country_grid_rows AS (101 SELECT (st_dump(geom)).geom102 FROM country_grid103 )104 SELECT105 row_number() OVER () AS id,106 country_grid_rows.geom,107 centroid_geom::geography AS centroid_location,108 nearest_postal_code.postal_code AS centroid_postal_code,109 nearest_postal_code.state_code AS centroid_postal_code_state_code,110 nearest_postal_code.city AS centroid_postal_code_city,111 nearest_postal_code.county_name AS centroid_postal_code_county,112 nearest_postal_code.location AS centroid_postal_code_location,113 CASE WHEN st_intersects(centroid_geom, country_boundary.geom) THEN centroid_geom ELSE nearest_postal_code.location END AS centroid_land_location114 FROM country_grid_rows,115 country_boundary,116 st_centroid(country_grid_rows.geom) AS centroid_geom117 CROSS JOIN LATERAL (118 SELECT *119 FROM postal_codes120 ORDER BY location <-> centroid_geom::geography121 LIMIT 1122 ) nearest_postal_code123 WHERE st_area(country_grid_rows.geom) < 5124 WITH DATA;125 `);126 await knex.raw(`127 CREATE MATERIALIZED VIEW state_grid_11km128 AS129 WITH130 country_boundary AS (131 SELECT st_union(boundaries::geometry) AS geom132 FROM states133 ),134 country_grid AS (135 SELECT make_rect_grid(geom, 11000, 11000) AS geom136 FROM country_boundary137 ),138 country_grid_rows AS (139 SELECT (st_dump(geom)).geom140 FROM country_grid141 ),142 state_grid_rows AS (143 SELECT144 ST_Intersection(country_grid_rows.geom, states.boundaries::geometry) AS geom,145 states.code AS state_code146 FROM country_grid_rows147 INNER JOIN states ON ST_Intersects(country_grid_rows.geom, states.boundaries::geometry)148 )149 SELECT150 row_number() OVER () AS id,151 state_grid_rows.state_code,152 state_grid_rows.geom,153 centroid_geom::geography AS centroid_location,154 nearest_postal_code.postal_code AS centroid_postal_code,155 nearest_postal_code.state_code AS centroid_postal_code_state_code,156 nearest_postal_code.city AS centroid_postal_code_city,157 nearest_postal_code.county_name AS centroid_postal_code_county,158 nearest_postal_code.location AS centroid_postal_code_location,159 CASE WHEN st_intersects(centroid_geom, country_boundary.geom) THEN centroid_geom ELSE nearest_postal_code.location END AS centroid_land_location160 FROM state_grid_rows,161 country_boundary,162 st_centroid(state_grid_rows.geom) AS centroid_geom163 CROSS JOIN LATERAL (164 SELECT *165 FROM postal_codes166 ORDER BY location <-> centroid_geom::geography167 LIMIT 1168 ) nearest_postal_code169 WHERE st_area(state_grid_rows.geom) < 5170 WITH DATA;171 `);172 await knex.schema.table("country_grid_22km", (table) => {173 table.index("geom", null, "gist");174 table.index("centroid_location", null, "gist");175 });176 await knex.schema.table("state_grid_22km", (table) => {177 table.index("geom", null, "gist");178 table.index("centroid_location", null, "gist");179 });180 await knex.schema.table("country_grid_11km", (table) => {181 table.index("geom", null, "gist");182 table.index("centroid_location", null, "gist");183 });184 await knex.schema.table("state_grid_11km", (table) => {185 table.index("geom", null, "gist");186 table.index("centroid_location", null, "gist");187 });188};189exports.down = async function (knex) {190 await knex.raw("DROP MATERIALIZED VIEW country_grid_22km");191 await knex.raw("DROP MATERIALIZED VIEW state_grid_22km");192 await knex.raw("DROP MATERIALIZED VIEW country_grid_11km");193 await knex.raw("DROP MATERIALIZED VIEW state_grid_11km");...

Full Screen

Full Screen

pages.js

Source:pages.js Github

copy

Full Screen

1export { default as Page_00 } from './pages/00/index.svelte';2export { default as Page_01 } from './pages/01/index.svelte';3export { default as Page_02 } from './pages/02/index.svelte';4export { default as Page_03 } from './pages/03/index.svelte';5export { default as Page_04 } from './pages/04/index.svelte';6export { default as Page_05 } from './pages/05/index.svelte';7export { default as Page_06 } from './pages/06/index.svelte';8export { default as Page_07 } from './pages/07/index.svelte';9export { default as Page_08 } from './pages/08/index.svelte';10export { default as Page_09 } from './pages/09/index.svelte';11export { default as Page_10 } from './pages/10/index.svelte';12export { default as Page_11 } from './pages/11/index.svelte';13export { default as Page_12 } from './pages/12/index.svelte';14export { default as Page_13 } from './pages/13/index.svelte';15export { default as Page_14 } from './pages/14/index.svelte';16export { default as Page_15 } from './pages/15/index.svelte';17export { default as Page_16 } from './pages/16/index.svelte';18export { default as Page_17 } from './pages/17/index.svelte';19export { default as Page_18 } from './pages/18/index.svelte';20export { default as Page_19 } from './pages/19/index.svelte';21export { default as Page_20 } from './pages/20/index.svelte';22export { default as Page_21 } from './pages/21/index.svelte';23export { default as Page_22 } from './pages/22/index.svelte';24export { default as Page_23 } from './pages/23/index.svelte';25export { default as Page_24 } from './pages/24/index.svelte';26export { default as Page_25 } from './pages/25/index.svelte';27export { default as Page_26 } from './pages/26/index.svelte';28export { default as Page_27 } from './pages/27/index.svelte';29export { default as Page_28 } from './pages/28/index.svelte';30export { default as Page_29 } from './pages/29/index.svelte';31export { default as Page_30 } from './pages/30/index.svelte';32export { default as Page_31 } from './pages/31/index.svelte';33export { default as Page_32 } from './pages/32/index.svelte';34export { default as Page_33 } from './pages/33/index.svelte';35export { default as Page_34 } from './pages/34/index.svelte';36export { default as Page_35 } from './pages/35/index.svelte';37export { default as Page_36 } from './pages/36/index.svelte';38export { default as Page_37 } from './pages/37/index.svelte';39export { default as Page_38 } from './pages/38/index.svelte';40export { default as Page_39 } from './pages/39/index.svelte';41export { default as Page_40 } from './pages/40/index.svelte';42export { default as Page_41 } from './pages/41/index.svelte';43export { default as Page_42 } from './pages/42/index.svelte';44export { default as Page_43 } from './pages/43/index.svelte';45export { default as Page_44 } from './pages/44/index.svelte';46export { default as Page_45 } from './pages/45/index.svelte';47export { default as Page_46 } from './pages/46/index.svelte';48export { default as Page_47 } from './pages/47/index.svelte';49export { default as Page_48 } from './pages/48/index.svelte';50export { default as Page_49 } from './pages/49/index.svelte';51export { default as Page_50 } from './pages/50/index.svelte';52export { default as Page_51 } from './pages/51/index.svelte';53export { default as Page_52 } from './pages/52/index.svelte';54export { default as Page_53 } from './pages/53/index.svelte';55export { default as Page_54 } from './pages/54/index.svelte';56export { default as Page_55 } from './pages/55/index.svelte';57export { default as Page_56 } from './pages/56/index.svelte';58export { default as Page_57 } from './pages/57/index.svelte';59export { default as Page_58 } from './pages/58/index.svelte';60export { default as Page_59 } from './pages/59/index.svelte';61export { default as Page_60 } from './pages/60/index.svelte';62export { default as Page_61 } from './pages/61/index.svelte';63export { default as Page_62 } from './pages/62/index.svelte';64export { default as Page_63 } from './pages/63/index.svelte';65export { default as Page_64 } from './pages/64/index.svelte';66export { default as Page_65 } from './pages/65/index.svelte';67export { default as Page_66 } from './pages/66/index.svelte';68export { default as Page_67 } from './pages/67/index.svelte';69export { default as Page_68 } from './pages/68/index.svelte';70export { default as Page_69 } from './pages/69/index.svelte';71export { default as Page_70 } from './pages/70/index.svelte';72export { default as Page_71 } from './pages/71/index.svelte';73export { default as Page_72 } from './pages/72/index.svelte';74export { default as Page_73 } from './pages/73/index.svelte';75export { default as Page_74 } from './pages/74/index.svelte';76export { default as Page_75 } from './pages/75/index.svelte';77export { default as Page_76 } from './pages/76/index.svelte';78export { default as Page_77 } from './pages/77/index.svelte';79export { default as Page_78 } from './pages/78/index.svelte';80export { default as Page_79 } from './pages/79/index.svelte';81export { default as Page_80 } from './pages/80/index.svelte';82export { default as Page_81 } from './pages/81/index.svelte';83export { default as Page_82 } from './pages/82/index.svelte';84export { default as Page_83 } from './pages/83/index.svelte';85export { default as Page_84 } from './pages/84/index.svelte';86export { default as Page_85 } from './pages/85/index.svelte';87export { default as Page_86 } from './pages/86/index.svelte';88export { default as Page_87 } from './pages/87/index.svelte';89export { default as Page_88 } from './pages/88/index.svelte';90export { default as Page_89 } from './pages/89/index.svelte';91export { default as Page_90 } from './pages/90/index.svelte';92export { default as Page_91 } from './pages/91/index.svelte';93export { default as Page_92 } from './pages/92/index.svelte';94export { default as Page_93 } from './pages/93/index.svelte';95export { default as Page_94 } from './pages/94/index.svelte';96export { default as Page_95 } from './pages/95/index.svelte';97export { default as Page_96 } from './pages/96/index.svelte';98export { default as Page_97 } from './pages/97/index.svelte';99export { default as Page_98 } from './pages/98/index.svelte';...

Full Screen

Full Screen

fifo-animal-shelter.test.js

Source:fifo-animal-shelter.test.js Github

copy

Full Screen

1'use strict';2const AnimalShelter = require('../fifo-animal-shelter.js');3describe('`AnimalShelter` class', () => {4 it('Can successfully instantiate an empty animal shelter`', () => {5 const as = new AnimalShelter();6 expect(as).toBeDefined();7 });8 describe('`enqueue(animal)` method', () => {9 it('Can successfully `enqueue` a `dog` or `cat` onto a stack', () => {10 const as = new AnimalShelter();11 as.enqueue('dog');12 expect(as.front.data).toBe('dog');13 });14 it('Can successfully `enqueue` multiple animals onto a stack', () => {15 const as = new AnimalShelter();16 as.enqueue('cat');17 as.enqueue('dog');18 as.enqueue('dog');19 expect(as.front.data).toBe('cat');20 expect(as.front.next.data).toBe('dog');21 expect(as.back.data).toBe('dog');22 });23 it('Returns `null` if `enqueue` is used on an animal other then a dog or cat', () => {24 const as = new AnimalShelter();25 const attempt = as.enqueue('mouse');26 expect(attempt).toBeNull();27 });28 });29 describe('`dequeue(pref)` method', () => {30 it('Can successfully `dequeue` off the animal shelter the expected value', () => {31 const as = new AnimalShelter();32 as.enqueue('cat');33 const value = as.dequeue('cat');34 expect(value).toBe('cat');35 });36 it('Can successfully empty an animal shelter after multiple `dequeue`s.', () => {37 const as = new AnimalShelter();38 as.enqueue('cat');39 as.enqueue('dog');40 as.enqueue('dog');41 expect(as.front.data).toBe('cat');42 as.dequeue('cat');43 expect(as.front.data).toBe('dog');44 as.dequeue('dog');45 expect(as.front.data).toBe('dog');46 as.dequeue('dog');47 expect(as.front).toBeNull();48 });49 it('Can successfully `dequeue` an animal that is not at the front', () => {50 const as = new AnimalShelter();51 as.enqueue('cat');52 as.enqueue('cat');53 as.enqueue('cat');54 as.enqueue('cat');55 as.enqueue('cat');56 as.enqueue('dog');57 const pref = as.dequeue('dog');58 expect(pref).toBe('dog');59 });60 it('Returns `null` if the animal shelter is empty', () => {61 const as = new AnimalShelter();62 const oops = as.dequeue('cat');63 expect(oops).toBeNull();64 });65 it('Returns `null` if there is one animal in the shelter, but it is not `pref`', () => {66 const as = new AnimalShelter();67 as.enqueue('cat');68 const oops = as.dequeue('dog');69 expect(as.front.data).toBe('cat');70 expect(oops).toBeNull();71 });72 it('Returns `null` if the `pref` is not a `dog` or `cat`', () => {73 const as = new AnimalShelter();74 const oops = as.dequeue('platypus');75 expect(oops).toBeNull();76 });77 it('Maintains FIFO order after multiple dequeues', () => {78 const as = new AnimalShelter();79 as.enqueue('cat');80 as.enqueue('cat');81 as.enqueue('dog');82 as.enqueue('dog');83 as.enqueue('cat');84 as.dequeue('dog');85 expect(as.front.data).toBe('cat');86 expect(as.front.next.data).toBe('cat');87 expect(as.front.next.next.data).toBe('dog');88 expect(as.front.next.next.next.data).toBe('cat');89 });90 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('getBySel', (selector, ...args) => {2 return cy.get(`[data-test=${selector}]`, ...args)3})4Cypress.Commands.add('getBySelLike', (selector, ...args) => {5 return cy.get(`[data-test*=${selector}]`, ...args)6})7describe('test', () => {8 it('test', () => {9 cy.getBySel('test').click()10 cy.getBySelLike('test').click()11 })12})

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('getBySel', (selector, ...args) => {2 return cy.get(`[data-cy=${selector}]`, ...args);3});4Cypress.Commands.add('getBySelLike', (selector, ...args) => {5 return cy.get(`[data-cy*=${selector}]`, ...args);6});7Cypress.Commands.add('getBySel', (selector, ...args) => {8 return cy.get(`[data-cy=${selector}]`, ...args);9});10Cypress.Commands.add('getBySelLike', (selector, ...args) => {11 return cy.get(`[data-cy*=${selector}]`, ...args);12});13Cypress.Commands.add('getBySel', (selector, ...args) => {14 return cy.get(`[data-cy=${selector}]`, ...args);15});16Cypress.Commands.add('getBySelLike', (selector, ...args) => {17 return cy.get(`[data-cy*=${selector}]`, ...args);18});19Cypress.Commands.add('getBySel', (selector, ...args) => {20 return cy.get(`[data-cy=${selector}]`, ...args);21});22Cypress.Commands.add('getBySelLike', (selector, ...args) => {23 return cy.get(`[data-cy*=${selector}]`, ...args);24});25Cypress.Commands.add('getBySel', (selector, ...args) => {26 return cy.get(`[data-cy=${selector}]`, ...args);27});28Cypress.Commands.add('getBySelLike', (selector, ...args) => {29 return cy.get(`[data-cy*=${selector}]`, ...args);30});31Cypress.Commands.add('getBySel', (selector, ...args) => {32 return cy.get(`[data-cy=${selector}]`, ...args);33});34Cypress.Commands.add('getBySelLike', (selector, ...args) => {35 return cy.get(`[data-cy*=${selector}]`, ...args);36});

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add("selectProduct", (productName) => {2 cy.get('h4.card-title').each(($el, index, $list) => {3 if ($el.text().includes(productName)) {4 cy.get('button.btn.btn-info').eq(index).click()5 }6 })7})8describe('My First Test Suite', function () {9 it('My FirstTest case', function () {10 cy.get('tr td:nth-child(2)').each(($el, index, $list) => {11 const text = $el.text()12 if (text.includes("Python")) {13 cy.get('tr td:nth-child(2)').eq(index).next().then(function (price) {14 const priceText = price.text()15 expect(priceText).to.equal('25')16 })17 }18 })19 })20})21describe('My First Test Suite', function () {22 it('My FirstTest case', function () {23 cy.selectProduct('Python')24 })25})26describe('My First Test Suite', function () {27 it('My FirstTest case', function () {28 cy.selectProduct('Python')29 cy.selectProduct('Cypress')30 })31})32describe('My First Test Suite', function () {33 it('My FirstTest case', function () {34 cy.selectProduct('Python')35 cy.selectProduct('Cypress')36 cy.get('.cart-icon > img').click()37 cy.contains('PROCEED TO CHECKOUT').click()38 cy.contains('Place Order').click()39 })40})41describe('My First Test Suite', function

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add("login", (email, password) => {2 cy.visit("/login");3 cy.get("input[type=email]").type(email);4 cy.get("input[type=password]").type(password);5 cy.get("button[type=submit]").click();6});7describe("Login", () => {8 it("should login a user", () => {9 cy.login("

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add("login", (email, password) => {2 cy.get('input[name="email"]').type(email)3 cy.get('input[name="password"]').type(password)4 cy.get('button[type="submit"]').click()5})6describe('Login', () => {7 beforeEach(() => {8 })9 it('should login successfully', () => {10 cy.login('

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('login', (username, password) => {2 cy.get('#username').type(username);3 cy.get('#password').type(password);4 cy.get('#login-button').click();5});6describe('Login', () => {7 it('should login with correct credentials', () => {8 cy.login('admin', 'admin');9 });10});11[MIT](

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('login', (email, password) => {2 cy.get('#email').type(email)3 cy.get('#password').type(password)4 cy.get('#login').click()5})6describe('Login', () => {7 it('with valid credentials', () => {8 cy.login('email', 'password')9 })10})11describe('Login', () => {12 it('with valid credentials', () => {13 cy.login('email', 'password')14 cy.get('#logout').should('be.visible')15 })16})17describe('Login', () => {18 it('with valid credentials', () => {19 cy.login('email', 'password')20 cy.get('#logout').should('be.visible')21 cy.get('#logout').click()22 })23})24describe('Login', () => {25 it('with valid credentials', () => {26 cy.login('email', 'password')27 cy.get('#logout').should('be.visible')28 cy.get('#logout').click()29 cy.get('#login').should('be.visible')30 })31})32describe('Login', () => {33 it('with valid credentials', () => {34 cy.login('email', 'password')35 cy.get('#logout').should('be.visible')36 cy.get('#logout').click()37 cy.get('#login').should('be.visible')38 cy.get('#login').click()39 })40})41describe('Login', () => {42 it('with valid credentials', () => {43 cy.login('email', 'password')44 cy.get('#logout').should('be.visible')45 cy.get('#logout').click()46 cy.get('#login').should('be.visible')47 cy.get('#login').click()48 cy.get('#email').should('be.visible')49 })50})51describe('Login', () => {52 it('with valid credentials', () => {53 cy.login('email', 'password')54 cy.get('#logout').should('be.visible')55 cy.get('#logout').click()56 cy.get('#login').should('be.visible')57 cy.get('#login').click()58 cy.get('#email').should('be.visible')

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('login', (username, password) => {2 cy.get('#username').type(username)3 cy.get('#password').type(password)4 cy.get('#login-button').click()5})6Cypress.Commands.add('login', (username, password) => {7 cy.get('#username').type(username)8 cy.get('#password').type(password)9 cy.get('#login-button').click()10})11Cypress.Commands.add('login', (username, password) => {12 cy.get('#username').type(username)13 cy.get('#password').type(password)14 cy.get('#login-button').click()15})16Cypress.Commands.add('login', (username, password) => {17 cy.get('#username').type(username)18 cy.get('#password').type(password)19 cy.get('#login-button').click()20})21Cypress.Commands.add('login', (username, password) => {22 cy.get('#username').type(username)23 cy.get('#password').type(password)24 cy.get('#login-button').click()25})26Cypress.Commands.add('login', (username, password) => {27 cy.get('#username').type(username)28 cy.get('#password').type(password)29 cy.get('#login-button').click()30})31Cypress.Commands.add('login', (username, password) => {32 cy.get('#username').type(username)33 cy.get('#password').type(password)34 cy.get('#login-button').click()35})36Cypress.Commands.add('login', (username, password) => {37 cy.get('#username').type(username)38 cy.get('#password').type(password)39 cy.get('#login-button').click()40})41Cypress.Commands.add('login', (username, password) => {42 cy.get('#username').type(username)43 cy.get('#password').type(password)44 cy.get('#login-button').click()45})46Cypress.Commands.add('login', (username, password) => {47 cy.get('#username').type(username)48 cy.get('#password').type

Full Screen

Using AI Code Generation

copy

Full Screen

1export function generateRandomName() {2 const randomName = Math.random().toString(36).substring(7);3 return randomName;4}5Cypress.Commands.add('generateRandomName', generateRandomName);6cy.generateRandomName().then((randomName) => {7 cy.log(randomName);8});

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful