test
This commit is contained in:
		
							
								
								
									
										38
									
								
								AppTest.js
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								AppTest.js
									
									
									
									
									
								
							@@ -7,23 +7,31 @@
 | 
			
		||||
 | 
			
		||||
// @ts-nocheck
 | 
			
		||||
/* eslint-disable no-console */
 | 
			
		||||
/* eslint-disable id-match */
 | 
			
		||||
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line node/no-missing-require, id-match
 | 
			
		||||
const { InteractiveOptions } = require ('./dist/lib/index.js');
 | 
			
		||||
const {
 | 
			
		||||
  StringOption,
 | 
			
		||||
  BooleanOption,
 | 
			
		||||
  NumberOption,
 | 
			
		||||
  ArrayOption,
 | 
			
		||||
  FolderOption
 | 
			
		||||
} = require ('./dist/lib/index.js');
 | 
			
		||||
 | 
			
		||||
(async () => {
 | 
			
		||||
  const reader = new InteractiveOptions ([
 | 
			
		||||
    { name: 'str', type: 'string', env: 'TEST_STR' },
 | 
			
		||||
    { name: 'bool', type: 'boolean', env: 'TEST_BOOL' },
 | 
			
		||||
    { name: 'num', type: 'number', env: 'TEST_NUM' },
 | 
			
		||||
    { name: 'arr', type: 'array', env: 'TEST_ARR' },
 | 
			
		||||
    { name: 'fld', type: 'folder', env: 'TEST_FOLDER' }
 | 
			
		||||
  ], {
 | 
			
		||||
    exit_on_interrupt: true,
 | 
			
		||||
    configs:           [ 'test.json' ],
 | 
			
		||||
    error_callback:    console.log
 | 
			
		||||
  });
 | 
			
		||||
  await reader.parse ();
 | 
			
		||||
  console.log (reader.serialize (true));
 | 
			
		||||
  const str = await new StringOption ({ name: 'str' })
 | 
			
		||||
    .parse ();
 | 
			
		||||
  const bool = await new BooleanOption ({ name: 'bool' })
 | 
			
		||||
    .parse ();
 | 
			
		||||
  const num = await new NumberOption ({ name: 'num' })
 | 
			
		||||
    .parse ();
 | 
			
		||||
  const arr = await new ArrayOption ({ name: 'arr' })
 | 
			
		||||
    .parse ();
 | 
			
		||||
  const fld = await new FolderOption ({ name: 'fld' })
 | 
			
		||||
    .parse ();
 | 
			
		||||
 | 
			
		||||
  const data = { str, bool, num, arr, fld };
 | 
			
		||||
 | 
			
		||||
  console.log (data);
 | 
			
		||||
}) ();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user