1- const { t, not, ot } = require ( './test.js' )
1+ /* eslint no-console: 0 */
2+
3+ const { t, not, ot } = require ( './test.js' ) // eslint-disable-line
24const cp = require ( 'child_process' )
35const path = require ( 'path' )
46
@@ -218,7 +220,7 @@ t('Parallel transactions', async() => {
218220 await sql `create table test (a int)`
219221 return [ '11' , ( await Promise . all ( [
220222 sql . begin ( sql => sql `select 1` ) ,
221- sql . begin ( sql => sql `select 1` ) ,
223+ sql . begin ( sql => sql `select 1` )
222224 ] ) ) . map ( x => x . count ) . join ( '' ) ]
223225} , ( ) => sql `drop table test` )
224226
@@ -244,7 +246,7 @@ t('Transaction waits', async() => {
244246
245247 return [ '11' , ( await Promise . all ( [
246248 sql . begin ( sql => sql `select 1` ) ,
247- sql . begin ( sql => sql `select 1` ) ,
249+ sql . begin ( sql => sql `select 1` )
248250 ] ) ) . map ( x => x . count ) . join ( '' ) ]
249251} , ( ) => sql `drop table test` )
250252
@@ -260,7 +262,7 @@ t('Throw syntax error', async() =>
260262
261263t ( 'Connect using uri' , async ( ) =>
262264 [ true , await new Promise ( ( resolve , reject ) => {
263- const sql = postgres ( 'postgres://' + login . user + ':' + ( login . pass || '' ) + '@localhost:5432/' + options . db , {
265+ const sql = postgres ( 'postgres://' + login . user + ':' + ( login . pass || '' ) + '@localhost:5432/' + options . db , {
264266 timeout : 0.1
265267 } )
266268 sql `select 1` . then ( ( ) => resolve ( true ) , reject )
@@ -515,7 +517,7 @@ t('double listen', async() => {
515517 ) . then ( ( ) => count ++ )
516518
517519 // for coverage
518- sql . listen ( 'weee' , ( ) => { } ) . then ( sql . end )
520+ sql . listen ( 'weee' , ( ) => { /* noop */ } ) . then ( sql . end )
519521
520522 return [ 2 , count ]
521523} )
@@ -571,7 +573,7 @@ t('await sql() throws not tagged error', async() => {
571573 let error
572574 try {
573575 await sql ( 'select 1' )
574- } catch ( e ) {
576+ } catch ( e ) {
575577 error = e . code
576578 }
577579 return [ 'NOT_TAGGED_CALL' , error ]
@@ -580,8 +582,8 @@ t('await sql() throws not tagged error', async() => {
580582t ( 'sql().then throws not tagged error' , async ( ) => {
581583 let error
582584 try {
583- sql ( 'select 1' ) . then ( ( ) => { } )
584- } catch ( e ) {
585+ sql ( 'select 1' ) . then ( ( ) => { /* noop */ } )
586+ } catch ( e ) {
585587 error = e . code
586588 }
587589 return [ 'NOT_TAGGED_CALL' , error ]
@@ -591,7 +593,7 @@ t('sql().catch throws not tagged error', async() => {
591593 let error
592594 try {
593595 await sql ( 'select 1' )
594- } catch ( e ) {
596+ } catch ( e ) {
595597 error = e . code
596598 }
597599 return [ 'NOT_TAGGED_CALL' , error ]
@@ -600,45 +602,45 @@ t('sql().catch throws not tagged error', async() => {
600602t ( 'sql().finally throws not tagged error' , async ( ) => {
601603 let error
602604 try {
603- sql ( 'select 1' ) . finally ( ( ) => { } )
604- } catch ( e ) {
605+ sql ( 'select 1' ) . finally ( ( ) => { /* noop */ } )
606+ } catch ( e ) {
605607 error = e . code
606608 }
607609 return [ 'NOT_TAGGED_CALL' , error ]
608610} )
609611
610- t ( 'dynamic column name' , async ( ) => {
612+ t ( 'dynamic column name' , async ( ) => {
611613 return [ '!not_valid' , Object . keys ( ( await sql `select 1 as ${ sql ( '!not_valid' ) } ` ) [ 0 ] ) [ 0 ] ]
612614} )
613615
614- t ( 'dynamic select as' , async ( ) => {
616+ t ( 'dynamic select as' , async ( ) => {
615617 return [ 2 , ( await sql `select ${ sql ( { a : 1 , b : 2 } ) } ` ) [ 0 ] . b ]
616618} )
617619
618- t ( 'dynamic select as pluck' , async ( ) => {
620+ t ( 'dynamic select as pluck' , async ( ) => {
619621 return [ undefined , ( await sql `select ${ sql ( { a : 1 , b : 2 } , 'a' ) } ` ) [ 0 ] . b ]
620622} )
621623
622- t ( 'dynamic insert' , async ( ) => {
624+ t ( 'dynamic insert' , async ( ) => {
623625 await sql `create table test (a int, b text)`
624626 const x = { a : 42 , b : 'the answer' }
625627
626628 return [ 'the answer' , ( await sql `insert into test ${ sql ( x ) } returning *` ) [ 0 ] . b ]
627629} , ( ) => sql `drop table test` )
628630
629- t ( 'dynamic insert pluck' , async ( ) => {
631+ t ( 'dynamic insert pluck' , async ( ) => {
630632 await sql `create table test (a int, b text)`
631633 const x = { a : 42 , b : 'the answer' }
632634
633635 return [ null , ( await sql `insert into test ${ sql ( x , 'a' ) } returning *` ) [ 0 ] . b ]
634636} , ( ) => sql `drop table test` )
635637
636- t ( 'array insert' , async ( ) => {
638+ t ( 'array insert' , async ( ) => {
637639 await sql `create table test (a int, b int)`
638- return [ 2 , ( await sql `insert into test (a, b) values (${ [ 1 , 2 ] } ) returning *` ) [ 0 ] . b ]
640+ return [ 2 , ( await sql `insert into test (a, b) values (${ [ 1 , 2 ] } ) returning *` ) [ 0 ] . b ]
639641} , ( ) => sql `drop table test` )
640642
641- t ( 'parameters in()' , async ( ) => {
643+ t ( 'parameters in()' , async ( ) => {
642644 return [ 2 , ( await sql `
643645 with rows as (
644646 select * from (values (1), (2), (3), (4)) as x(a)
@@ -647,34 +649,34 @@ t('parameters in()', async () => {
647649 ` ) . count ]
648650} )
649651
650- t ( 'dynamic multi row insert' , async ( ) => {
652+ t ( 'dynamic multi row insert' , async ( ) => {
651653 await sql `create table test (a int, b text)`
652654 const x = { a : 42 , b : 'the answer' }
653655
654656 return [ 'the answer' , ( await sql `insert into test ${ sql ( [ x , x ] ) } returning *` ) [ 1 ] . b ]
655657} , ( ) => sql `drop table test` )
656658
657- t ( 'dynamic update' , async ( ) => {
659+ t ( 'dynamic update' , async ( ) => {
658660 await sql `create table test (a int, b text)`
659661 await sql `insert into test (a, b) values (17, 'wrong')`
660662
661663 return [ 'the answer' , ( await sql `update test set ${ sql ( { a : 42 , b : 'the answer' } ) } returning *` ) [ 0 ] . b ]
662664} , ( ) => sql `drop table test` )
663665
664- t ( 'dynamic update pluck' , async ( ) => {
666+ t ( 'dynamic update pluck' , async ( ) => {
665667 await sql `create table test (a int, b text)`
666668 await sql `insert into test (a, b) values (17, 'wrong')`
667669
668670 return [ 'wrong' , ( await sql `update test set ${ sql ( { a : 42 , b : 'the answer' } , 'a' ) } returning *` ) [ 0 ] . b ]
669671} , ( ) => sql `drop table test` )
670672
671- t ( 'dynamic select array' , async ( ) => {
673+ t ( 'dynamic select array' , async ( ) => {
672674 await sql `create table test (a int, b text)`
673675 await sql `insert into test (a, b) values (42, 'yay')`
674676 return [ 'yay' , ( await sql `select ${ sql ( [ 'a' , 'b' ] ) } from test` ) [ 0 ] . b ]
675677} , ( ) => sql `drop table test` )
676678
677- t ( 'dynamic select args' , async ( ) => {
679+ t ( 'dynamic select args' , async ( ) => {
678680 await sql `create table test (a int, b text)`
679681 await sql `insert into test (a, b) values (42, 'yay')`
680682 return [ 'yay' , ( await sql `select ${ sql ( 'a' , 'b' ) } from test` ) [ 0 ] . b ]
@@ -766,13 +768,13 @@ t('Stream works', async() => {
766768} )
767769
768770t ( 'Stream returns empty array' , async ( ) => {
769- return [ 0 , ( await sql `select 1 as x` . stream ( x => { } ) ) . length ]
771+ return [ 0 , ( await sql `select 1 as x` . stream ( ( ) => { /* noop */ } ) ) . length ]
770772} )
771773
772774t ( 'Transform row' , async ( ) => {
773775 const sql = postgres ( {
774776 ...options ,
775- transform : { row : x => 1 }
777+ transform : { row : ( ) => 1 }
776778 } )
777779
778780 return [ 1 , ( await sql `select 'wat'` ) [ 0 ] ]
@@ -782,7 +784,7 @@ t('Transform row stream', async() => {
782784 let result
783785 const sql = postgres ( {
784786 ...options ,
785- transform : { row : x => 1 }
787+ transform : { row : ( ) => 1 }
786788 } )
787789
788790 await sql `select 1` . stream ( x => result = x )
@@ -793,7 +795,7 @@ t('Transform row stream', async() => {
793795t ( 'Transform value' , async ( ) => {
794796 const sql = postgres ( {
795797 ...options ,
796- transform : { value : x => 1 }
798+ transform : { value : ( ) => 1 }
797799 } )
798800
799801 return [ 1 , ( await sql `select 'wat' as x` ) [ 0 ] . x ]
@@ -816,7 +818,7 @@ t('Debug works', async() => {
816818 let result
817819 const sql = postgres ( {
818820 ...options ,
819- debug : ( connection_id , str , args ) => result = str
821+ debug : ( connection_id , str ) => result = str
820822 } )
821823
822824 await sql `select 1`
0 commit comments