@@ -75,10 +75,16 @@ let restoreEnv;
7575let functionsTest ;
7676
7777/** Helper to Mock Export */
78- const mockExport = ( document , data ) => {
78+ const mockExport = ( change , context = { } ) => {
7979 const ref = require ( "../src/index" ) . fsexportbigquery ;
80- const wrapped = functionsTest . wrap ( ref ) ;
81- return wrapped ( document , data ) ;
80+ return ref . run ( {
81+ data : change ,
82+ document : "example/doc1" ,
83+ id : "test-event-id" ,
84+ time : new Date ( ) . toISOString ( ) ,
85+ params : { documentId : "doc1" } ,
86+ ...context ,
87+ } ) ;
8288} ;
8389
8490describe ( "extension" , ( ) => {
@@ -120,9 +126,7 @@ describe("extension", () => {
120126 afterSnapshot
121127 ) ;
122128
123- const callResult = await mockExport ( documentChange , {
124- resource : { name : "example/doc1" } ,
125- } ) ;
129+ const callResult = await mockExport ( documentChange ) ;
126130
127131 expect ( callResult ) . toBeUndefined ( ) ;
128132
@@ -154,9 +158,7 @@ describe("extension", () => {
154158 afterSnapshot
155159 ) ;
156160
157- const callResult = await mockExport ( documentChange , {
158- resource : { name : "example/doc1" } ,
159- } ) ;
161+ const callResult = await mockExport ( documentChange ) ;
160162
161163 expect ( callResult ) . toBeUndefined ( ) ;
162164
0 commit comments