You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					22 lines
				
				420 B
			
		
		
			
		
	
	
					22 lines
				
				420 B
			| 
								 
											3 years ago
										 
									 | 
							
								'use strict'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const envSchema = require('../index')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function makeTest (t, options, isOk, confExpected, errorMessage) {
							 | 
						||
| 
								 | 
							
								  t.plan(1)
							 | 
						||
| 
								 | 
							
								  options = Object.assign({ confKey: 'config' }, options)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  try {
							 | 
						||
| 
								 | 
							
								    const conf = envSchema(options)
							 | 
						||
| 
								 | 
							
								    t.strictSame(conf, confExpected)
							 | 
						||
| 
								 | 
							
								  } catch (err) {
							 | 
						||
| 
								 | 
							
								    if (isOk) {
							 | 
						||
| 
								 | 
							
								      t.fail(err)
							 | 
						||
| 
								 | 
							
								      return
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    t.strictSame(err.message, errorMessage)
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								module.exports = makeTest
							 |