Javascript-Apollo.api_test.mustache Maven / Gradle / Ivy
{{>licenseInfo}}
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD.
define(['expect.js', process.cwd()+'/src/{{#invokerPackage}}{{.}}/{{/invokerPackage}}index'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
factory(require('expect.js'), require(process.cwd()+'/src/{{#invokerPackage}}{{.}}/{{/invokerPackage}}index'));
}
}(this, function(expect, {{moduleName}}) {
'use strict';
var instance;
beforeEach(function() {
instance = new {{moduleName}}.{{classname}}();
});
var getProperty = function(object, getter, property) {
// Use getter method if present; otherwise, get the property directly.
if (typeof object[getter] === 'function')
return object[getter]();
else
return object[property];
}
var setProperty = function(object, setter, property, value) {
// Use setter method if present; otherwise, set the property directly.
if (typeof object[setter] === 'function')
object[setter](value);
else
object[property] = value;
}
describe('{{classname}}', function() {
{{#operations}}
{{#operation}}
describe('{{operationId}}', function() {
it('should call {{operationId}} successfully', function(done) {
//uncomment below and update the code to test {{operationId}}
//instance.{{operationId}}(function(error) {
// if (error) throw error;
//expect().to.be();
//});
done();
});
});
{{/operation}}
{{/operations}}
});
}));