@@ -7,6 +7,8 @@ import DatabaseImporter from "../../database/import";
77import { FirebaseError } from "../../error" ;
88
99const dbUrl = new URL ( "https://test-db.firebaseio.com/foo" ) ;
10+ const chunkSize = 1024 * 1024 * 10 ;
11+ const concurrencyLimit = 5 ;
1012
1113describe ( "DatabaseImporter" , ( ) => {
1214 const DATA = { a : 100 , b : [ true , "bar" , { f : { g : 0 , h : 1 } , i : "baz" } ] } ;
@@ -22,7 +24,9 @@ describe("DatabaseImporter", () => {
2224 const importer = new DatabaseImporter (
2325 dbUrl ,
2426 utils . stringToStream ( INVALID_JSON ) ! ,
25- /* importPath= */ "/"
27+ /* importPath= */ "/" ,
28+ chunkSize ,
29+ concurrencyLimit
2630 ) ;
2731
2832 await expect ( importer . execute ( ) ) . to . be . rejectedWith (
@@ -37,7 +41,13 @@ describe("DatabaseImporter", () => {
3741 nock ( "https://test-db.firebaseio.com" )
3842 . put ( "/foo/b.json" , JSON . stringify ( [ true , "bar" , { f : { g : 0 , h : 1 } , i : "baz" } ] ) )
3943 . reply ( 200 ) ;
40- const importer = new DatabaseImporter ( dbUrl , DATA_STREAM , /* importPath= */ "/" ) ;
44+ const importer = new DatabaseImporter (
45+ dbUrl ,
46+ DATA_STREAM ,
47+ /* importPath= */ "/" ,
48+ chunkSize ,
49+ concurrencyLimit
50+ ) ;
4151
4252 const responses = await importer . execute ( ) ;
4353
@@ -58,7 +68,8 @@ describe("DatabaseImporter", () => {
5868 dbUrl ,
5969 DATA_STREAM ,
6070 /* importPath= */ "/" ,
61- /* chunkSize= */ 20
71+ /* chunkSize= */ 20 ,
72+ concurrencyLimit
6273 ) ;
6374
6475 const responses = await importer . execute ( ) ;
@@ -72,7 +83,13 @@ describe("DatabaseImporter", () => {
7283 nock ( "https://test-db.firebaseio.com" )
7384 . put ( "/foo/b.json" , JSON . stringify ( [ true , "bar" , { f : { g : 0 , h : 1 } , i : "baz" } ] ) )
7485 . reply ( 200 ) ;
75- const importer = new DatabaseImporter ( dbUrl , DATA_STREAM , /* importPath= */ "/b" ) ;
86+ const importer = new DatabaseImporter (
87+ dbUrl ,
88+ DATA_STREAM ,
89+ /* importPath= */ "/b" ,
90+ chunkSize ,
91+ concurrencyLimit
92+ ) ;
7693
7794 const responses = await importer . execute ( ) ;
7895
@@ -82,7 +99,13 @@ describe("DatabaseImporter", () => {
8299
83100 it ( "throws FirebaseError when data location is nonempty" , async ( ) => {
84101 nock ( "https://test-db.firebaseio.com" ) . get ( "/foo.json?shallow=true" ) . reply ( 200 , { a : "foo" } ) ;
85- const importer = new DatabaseImporter ( dbUrl , DATA_STREAM , /* importPath= */ "/" ) ;
102+ const importer = new DatabaseImporter (
103+ dbUrl ,
104+ DATA_STREAM ,
105+ /* importPath= */ "/" ,
106+ chunkSize ,
107+ concurrencyLimit
108+ ) ;
86109
87110 await expect ( importer . execute ( ) ) . to . be . rejectedWith (
88111 FirebaseError ,
0 commit comments