Fix tests for JS Mibew API

This commit is contained in:
Dmitriy Simushev 2014-02-10 15:51:42 +00:00
parent 30100a5a31
commit c20f285ca7

View File

@ -8,7 +8,8 @@ module('MibewAPIInteraction');
*/ */
function MibewAPITestInteraction() { function MibewAPITestInteraction() {
this.obligatoryArguments = { this.mandatoryArguments = function() {
return {
'*': { '*': {
'return': {}, 'return': {},
'references': {} 'references': {}
@ -17,38 +18,41 @@ function MibewAPITestInteraction() {
'bar': 127 'bar': 127
} }
}; };
}
this.reservedFunctionNames = [ this.getReservedFunctionsNames = function() {
return [
'result' 'result'
]; ];
}
} }
MibewAPITestInteraction.prototype = new MibewAPIInteraction(); MibewAPITestInteraction.prototype = new MibewAPIInteraction();
// Tests for the getObligatoryArguments method // Tests for the getMandatoryArguments method
test('getObligatoryArguments', function(){ test('getMandatoryArguments', function(){
var interaction = new MibewAPITestInteraction(); var interaction = new MibewAPITestInteraction();
// Arguments for all function // Arguments for all function
deepEqual( deepEqual(
interaction.getObligatoryArguments('some_function'), interaction.getMandatoryArguments('some_function'),
['return', 'references'], ['return', 'references'],
'Test with arguments for all functions' 'Test with arguments for all functions'
); );
// Arguments for specific function // Arguments for specific function
deepEqual( deepEqual(
interaction.getObligatoryArguments('foo'), interaction.getMandatoryArguments('foo'),
['return', 'references', 'bar'], ['return', 'references', 'bar'],
'Test with arguments for specific function' 'Test with arguments for specific function'
); );
}); });
// Tests for the getObligatoryArgumentsDefaults method // Tests for the getMandatoryArgumentsDefaults method
test('getObligatoryArgumentsDefaults', function(){ test('getMandatoryArgumentsDefaults', function(){
var interaction = new MibewAPITestInteraction(); var interaction = new MibewAPITestInteraction();
// Default values for arguments for all function // Default values for arguments for all function
deepEqual( deepEqual(
interaction.getObligatoryArgumentsDefaults('some_function'), interaction.getMandatoryArgumentsDefaults('some_function'),
{ {
'return': {}, 'return': {},
'references': {} 'references': {}
@ -58,7 +62,7 @@ test('getObligatoryArgumentsDefaults', function(){
// Default values for arguments for specific function // Default values for arguments for specific function
deepEqual( deepEqual(
interaction.getObligatoryArgumentsDefaults('foo'), interaction.getMandatoryArgumentsDefaults('foo'),
{ {
'return': {}, 'return': {},
'references': {}, 'references': {},
@ -150,8 +154,8 @@ test("checkFunction", function(){
} catch (e) { } catch (e) {
equal( equal(
e.message, e.message,
"Not all obligatory arguments are set in 'test' function", "Not all mandatory arguments are set in 'test' function",
"Test with not all obligatory arguments" "Test with not all mandatory arguments"
); );
} }