55import { SQLiteCloudError } from '../src/index'
66import { SQLiteCloudConnection , anonimizeCommand } from '../src/connection'
77import { parseConnectionString } from '../src/utilities'
8- import { CHINOOK_DATABASE_URL , TESTING_DATABASE_URL , LONG_TIMEOUT , getTestingConfig , getChinookConfig , getChinookConnection } from './shared'
9- import { Database } from 'sqlite3'
8+ import { CHINOOK_DATABASE_URL , LONG_TIMEOUT , getTestingConfig , getChinookConfig , getChinookConnection , WARN_SPEED_MS , EXPECT_SPEED_MS } from './shared'
109
1110describe ( 'connection' , ( ) => {
1211 let chinook : SQLiteCloudConnection
@@ -363,8 +362,10 @@ describe('connection', () => {
363362 expect ( results ) . toBe ( 'Hello World, this is a test string.' )
364363 if ( ++ completed >= numQueries ) {
365364 const queryMs = ( Date . now ( ) - startTime ) / numQueries
366- console . log ( `${ numQueries } x test string, ${ queryMs . toFixed ( 0 ) } ms per query` )
367- expect ( queryMs ) . toBeLessThan ( 2000 )
365+ if ( queryMs > WARN_SPEED_MS ) {
366+ console . log ( `${ numQueries } x test string, ${ queryMs . toFixed ( 0 ) } ms per query` )
367+ expect ( queryMs ) . toBeLessThan ( EXPECT_SPEED_MS )
368+ }
368369 done ( )
369370 }
370371 } )
@@ -386,8 +387,10 @@ describe('connection', () => {
386387 expect ( results . numberOfRows ) . toBe ( 4 )
387388 if ( ++ completed >= numQueries ) {
388389 const queryMs = ( Date . now ( ) - startTime ) / numQueries
389- console . log ( `${ numQueries } x individual selects, ${ queryMs . toFixed ( 0 ) } ms per query` )
390- expect ( queryMs ) . toBeLessThan ( 2000 )
390+ if ( queryMs > WARN_SPEED_MS ) {
391+ console . log ( `${ numQueries } x individual selects, ${ queryMs . toFixed ( 0 ) } ms per query` )
392+ expect ( queryMs ) . toBeLessThan ( EXPECT_SPEED_MS )
393+ }
391394 done ( )
392395 }
393396 } )
@@ -412,8 +415,10 @@ describe('connection', () => {
412415 expect ( results . numberOfRows ) . toBe ( 4 )
413416 if ( ++ completed >= numQueries ) {
414417 const queryMs = ( Date . now ( ) - startTime ) / numQueries
415- console . log ( `${ numQueries } x batched selects, ${ queryMs . toFixed ( 0 ) } ms per query` )
416- expect ( queryMs ) . toBeLessThan ( 5000 )
418+ if ( queryMs > WARN_SPEED_MS ) {
419+ console . log ( `${ numQueries } x batched selects, ${ queryMs . toFixed ( 0 ) } ms per query` )
420+ expect ( queryMs ) . toBeLessThan ( EXPECT_SPEED_MS )
421+ }
417422 done ( )
418423 }
419424 }
0 commit comments