@@ -7,8 +7,7 @@ require("@litejs/cli/test.js")
77
88describe ( "sqlite3" , function ( ) {
99 var openDb = require ( ".." )
10- this
11- . test ( "sqlite" , function ( assert , mock ) {
10+ test ( "sqlite" , function ( assert , mock ) {
1211 var db = openDb ( ":memory:" )
1312 db . run ( "CREATE TABLE t1 (t INTEGER PRIMARY KEY, val BLOB)" )
1413 db . run ( "INSERT INTO t1 VALUES (?, ?)" , [ 1 , "str" ] )
@@ -39,8 +38,8 @@ describe("sqlite3", function() {
3938 } )
4039 db . close ( assert . end )
4140 } )
42- . test ( "sqlite" , function ( assert , mock ) {
43- mock . rand ( )
41+ test ( "sqlite" , [ null , 2 , 44 , 45 , 46 , 72 , 79 , 82649 ] , function ( seed , assert , mock ) {
42+ mock . rand ( seed )
4443 var Transform = require ( "stream" ) . Transform
4544 , step = Math . floor ( Math . random ( ) * 25 ) + 4
4645 , smallChunks = new Transform ( {
@@ -157,7 +156,7 @@ describe("sqlite3", function() {
157156 } )
158157
159158 } )
160- . test ( "migrate" , function ( assert , mock ) {
159+ test ( "migrate" , function ( assert , mock ) {
161160 var os = require ( "os" )
162161 , fs = require ( "fs" )
163162 , path = require ( "path" )
@@ -209,14 +208,25 @@ describe("sqlite3", function() {
209208 } )
210209 } )
211210 } )
212- . test ( "open with nice and no file" , function ( assert ) {
211+ test ( "open with nice and no file" , function ( assert ) {
213212 var db = openDb ( undefined , { nice : 10 } )
214213 db . get ( "SELECT 1 AS x" , function ( err , row ) {
215214 assert . equal ( err , null )
216215 assert . equal ( row . x , 1 )
217216 db . close ( assert . end )
218217 } )
219218 } )
219+ test ( "lone newline chunk while awaiting header" , function ( assert ) {
220+ var db = openDb ( ":memory:" )
221+ db . run ( ".mode quote" , function ( ) {
222+ db . child . stdout . emit ( "data" , Buffer . from ( [ 10 ] ) )
223+ } )
224+ db . get ( "SELECT 1 AS x" , function ( err , row ) {
225+ assert . equal ( err , null )
226+ assert . equal ( row . x , 1 )
227+ db . close ( assert . end )
228+ } )
229+ } )
220230} )
221231
222232
0 commit comments