UNPKG

api-bdd-test

Version:

use the bdd(cucumber) to test the RESTfull API

48 lines (35 loc) 1.52 kB
(function() { var Api, ApiFeatures, Features, inherits; inherits = require('inherits-ex'); Api = require('loopback-supertest/lib/abstract-api'); Features = require('./features'); module.exports = ApiFeatures = (function() { inherits(ApiFeatures, Features); function ApiFeatures(aOptions) { if (aOptions == null) { aOptions = {}; } if (!(this instanceof ApiFeatures)) { return new ApiFeatures(aOptions); } this.server = aOptions.server; this.root = aOptions.root || aOptions.app; this.resource = aOptions.res || aOptions.resource; ApiFeatures.__super__.constructor.apply(this, arguments); } ApiFeatures.prototype.beforeFeature = function(feature, context) { context.resource = feature.annotations.res || feature.annotations.resource || this.resource; context.root = feature.annotations.root || feature.annotations.app || this.root; context.server = feature.annotations.server || this.server; context.api = Api(context.server, context.root); }; ApiFeatures.prototype.loadDefaultLib = function(aFeature, aLibrary, aDictionary, aLangName) { return ApiFeatures.__super__.loadDefaultLib.apply(this, arguments); }; ApiFeatures.prototype.loadDefaultDict = function(aFeature, aLibrary, aDictionary, aLangName) { return ApiFeatures.__super__.loadDefaultDict.apply(this, arguments); }; return ApiFeatures; })(); }).call(this); //# sourceMappingURL=api-features.js.map