@@ -179,25 +179,33 @@ describe('validateAdminArgs()', () => {
179179 describe ( 'and validateVars = true' , ( ) => {
180180 describe ( 'should succeed if vars WERE provided' , ( ) => {
181181 it ( 'and the first argument is a DataConnect instance' , ( ) => {
182+ let dcInstance , inputVars , inputOpts ;
182183 expect ( ( ) => {
183- const { dc : dcInstance , vars : inputVars , options : inputOpts } = validateAdminArgs (
184+ const parsedArgs = validateAdminArgs (
184185 connectorConfig , providedDcInstance , variables , undefined , true , true
185186 ) ;
186- expect ( dcInstance ) . to . deep . equal ( providedDcInstance ) ;
187- expect ( inputVars ) . to . deep . equal ( variables ) ;
188- expect ( inputOpts ) . to . be . undefined ;
189- } ) . to . not . throw ( invalidVariablesError ) ;
187+ dcInstance = parsedArgs . dc ;
188+ inputVars = parsedArgs . vars ;
189+ inputOpts = parsedArgs . options ;
190+ } ) . to . not . throw ( invalidVariablesError ) ;
191+ expect ( dcInstance ) . to . deep . equal ( providedDcInstance ) ;
192+ expect ( inputVars ) . to . deep . equal ( variables ) ;
193+ expect ( inputOpts ) . to . be . undefined ;
190194 } ) ;
191195
192196 it ( 'and the first argument is variables instance' , ( ) => {
197+ let dcInstance , inputVars , inputOpts ;
193198 expect ( ( ) => {
194- const { dc : dcInstance , vars : inputVars , options : inputOpts } = validateAdminArgs (
199+ const parsedArgs = validateAdminArgs (
195200 connectorConfig , variables , undefined , undefined , true , true
196201 ) ;
197- expect ( dcInstance ) . to . deep . equal ( stubDcInstance ) ;
198- expect ( inputVars ) . to . deep . equal ( variables ) ;
199- expect ( inputOpts ) . to . be . undefined ;
202+ dcInstance = parsedArgs . dc ;
203+ inputVars = parsedArgs . vars ;
204+ inputOpts = parsedArgs . options ;
200205 } ) . to . not . throw ( invalidVariablesError ) ;
206+ expect ( dcInstance ) . to . deep . equal ( stubDcInstance ) ;
207+ expect ( inputVars ) . to . deep . equal ( variables ) ;
208+ expect ( inputOpts ) . to . be . undefined ;
201209 } ) ;
202210 } ) ;
203211
@@ -219,14 +227,18 @@ describe('validateAdminArgs()', () => {
219227 describe ( 'and validateVars = false' , ( ) => {
220228 describe ( 'should succeed if vars WERE provided' , ( ) => {
221229 it ( 'and the first argument is a DataConnect instance' , ( ) => {
230+ let dcInstance , inputVars , inputOpts ;
222231 expect ( ( ) => {
223- const { dc : dcInstance , vars : inputVars , options : inputOpts } = validateAdminArgs (
232+ const parsedArgs = validateAdminArgs (
224233 connectorConfig , providedDcInstance , variables , undefined , true , false
225234 ) ;
226- expect ( dcInstance ) . to . deep . equal ( providedDcInstance ) ;
227- expect ( inputVars ) . to . be . undefined ;
228- expect ( inputOpts ) . to . be . undefined ;
235+ dcInstance = parsedArgs . dc ;
236+ inputVars = parsedArgs . vars ;
237+ inputOpts = parsedArgs . options ;
229238 } ) . to . not . throw ( invalidVariablesError ) ;
239+ expect ( dcInstance ) . to . deep . equal ( providedDcInstance ) ;
240+ expect ( inputVars ) . to . deep . equal ( variables ) ;
241+ expect ( inputOpts ) . to . be . undefined ;
230242 } ) ;
231243
232244 it ( 'and the first argument is variables instance' , ( ) => {
@@ -245,25 +257,33 @@ describe('validateAdminArgs()', () => {
245257
246258 describe ( 'should succeed if vars were NOT provided' , ( ) => {
247259 it ( 'and the first argument is a DataConnect instance' , ( ) => {
260+ let dcInstance , inputVars , inputOpts ;
248261 expect ( ( ) => {
249- const { dc : dcInstance , vars : inputVars , options : inputOpts } = validateAdminArgs (
262+ const parsedArgs = validateAdminArgs (
250263 connectorConfig , providedDcInstance , undefined , undefined , true , false
251264 ) ;
252- expect ( dcInstance ) . to . deep . equal ( providedDcInstance ) ;
253- expect ( inputVars ) . to . deep . equal ( variables ) ;
254- expect ( inputOpts ) . to . be . undefined ;
265+ dcInstance = parsedArgs . dc ;
266+ inputVars = parsedArgs . vars ;
267+ inputOpts = parsedArgs . options ;
255268 } ) . to . not . throw ( invalidVariablesError ) ;
269+ expect ( dcInstance ) . to . deep . equal ( providedDcInstance ) ;
270+ expect ( inputVars ) . to . be . undefined ;
271+ expect ( inputOpts ) . to . be . undefined ;
256272 } ) ;
257273
258274 it ( 'and the first argument is undefined variables' , ( ) => {
275+ let dcInstance , inputVars , inputOpts ;
259276 expect ( ( ) => {
260- const { dc : dcInstance , vars : inputVars , options : inputOpts } = validateAdminArgs (
277+ const parsedArgs = validateAdminArgs (
261278 connectorConfig , undefined , undefined , undefined , true , false
262279 ) ;
263- expect ( dcInstance ) . to . deep . equal ( stubDcInstance ) ;
264- expect ( inputVars ) . to . be . undefined ;
265- expect ( inputOpts ) . to . be . undefined ;
280+ dcInstance = parsedArgs . dc ;
281+ inputVars = parsedArgs . vars ;
282+ inputOpts = parsedArgs . options ;
266283 } ) . to . not . throw ( invalidVariablesError ) ;
284+ expect ( dcInstance ) . to . deep . equal ( stubDcInstance ) ;
285+ expect ( inputVars ) . to . be . undefined ;
286+ expect ( inputOpts ) . to . be . undefined ;
267287 } ) ;
268288 } ) ;
269289 } ) ;
0 commit comments