mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-01 05:44:41 +03:00
Fix tests for JS Mibew API
This commit is contained in:
parent
30100a5a31
commit
c20f285ca7
@ -8,47 +8,51 @@ module('MibewAPIInteraction');
|
|||||||
*/
|
*/
|
||||||
function MibewAPITestInteraction() {
|
function MibewAPITestInteraction() {
|
||||||
|
|
||||||
this.obligatoryArguments = {
|
this.mandatoryArguments = function() {
|
||||||
'*': {
|
return {
|
||||||
'return': {},
|
'*': {
|
||||||
'references': {}
|
'return': {},
|
||||||
},
|
'references': {}
|
||||||
'foo': {
|
},
|
||||||
'bar': 127
|
'foo': {
|
||||||
}
|
'bar': 127
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
this.reservedFunctionNames = [
|
this.getReservedFunctionsNames = function() {
|
||||||
'result'
|
return [
|
||||||
];
|
'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"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user