mirror of
				https://github.com/Mibew/java.git
				synced 2025-10-31 18:41:09 +03:00 
			
		
		
		
	Added tests for the JavaScript's MibewAPIInteraction class
This commit is contained in:
		
							parent
							
								
									8a88f48d89
								
							
						
					
					
						commit
						3ec23b5ae5
					
				| @ -1,5 +1,5 @@ | ||||
| // Testing MibewAPI class
 | ||||
| module("MibewAPI"); | ||||
| // Testing MibewAPIInteraction class
 | ||||
| module('MibewAPIInteraction'); | ||||
| 
 | ||||
| /** | ||||
|  * Represents test interaction type | ||||
| @ -7,24 +7,70 @@ module("MibewAPI"); | ||||
|  * @constructor | ||||
|  */ | ||||
| function MibewAPITestInteraction() { | ||||
| 
 | ||||
|     this.obligatoryArguments = { | ||||
|         '*': { | ||||
|             'return': {}, | ||||
|             'references': {} | ||||
|         }, | ||||
|         'foo': { | ||||
|             'bar': 127 | ||||
|         } | ||||
|     }; | ||||
| 
 | ||||
|     this.reservedFunctionNames = [ | ||||
|         'result' | ||||
|     ]; | ||||
| 
 | ||||
|     this.obligatoryArguments = [ | ||||
|         'return', | ||||
|         'references' | ||||
|     ]; | ||||
| 
 | ||||
|     this.getDefaultObligatoryArguments = function(){ | ||||
|         return { | ||||
|             "return" : {}, | ||||
|             "references" : {} | ||||
|         } | ||||
|     } | ||||
| } | ||||
| MibewAPITestInteraction.prototype = new MibewAPIInteraction(); | ||||
| 
 | ||||
| // Tests for the getObligatoryArguments method
 | ||||
| test('getObligatoryArguments', function(){ | ||||
|     var interaction = new MibewAPITestInteraction(); | ||||
|     // Arguments for all function
 | ||||
|     deepEqual( | ||||
|         interaction.getObligatoryArguments('some_function'), | ||||
|         ['return', 'references'], | ||||
|         'Test with arguments for all functions' | ||||
|     ); | ||||
| 
 | ||||
|     // Arguments for specific function
 | ||||
|     deepEqual( | ||||
|         interaction.getObligatoryArguments('foo'), | ||||
|         ['return', 'references', 'bar'], | ||||
|         'Test with arguments for specific function' | ||||
|     ); | ||||
| }); | ||||
| 
 | ||||
| // Tests for the getObligatoryArgumentsDefaults method
 | ||||
| test('getObligatoryArgumentsDefaults', function(){ | ||||
|     var interaction = new MibewAPITestInteraction(); | ||||
|     // Default values for arguments for all function
 | ||||
|     deepEqual( | ||||
|         interaction.getObligatoryArgumentsDefaults('some_function'), | ||||
|         { | ||||
|             'return': {}, | ||||
|             'references': {} | ||||
|         }, | ||||
|         'Test with default values for arguments for all functions' | ||||
|     ); | ||||
| 
 | ||||
|     // Default values for arguments for specific function
 | ||||
|     deepEqual( | ||||
|         interaction.getObligatoryArgumentsDefaults('foo'), | ||||
|         { | ||||
|             'return': {}, | ||||
|             'references': {}, | ||||
|             'bar': 127 | ||||
|         }, | ||||
|         'Test with default values for arguments for specific function' | ||||
|     ); | ||||
| }); | ||||
| 
 | ||||
| // Testing MibewAPI class
 | ||||
| module("MibewAPI"); | ||||
| 
 | ||||
| // Tests for the class constructor
 | ||||
| test("constructor", function(){ | ||||
|     // Incorrect initialization
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user