Skip to content

Commit

Permalink
simplified adding routes to swagger test server
Browse files Browse the repository at this point in the history
  • Loading branch information
ShurakaiSoft committed Feb 22, 2016
1 parent 224d8ce commit 1fd59f4
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions test/swagger.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,9 @@ describe('Swagger docs', function () {
{ register: HapiSwagger, options: swaggerOptions }
], () => {
server.start(() => {
_.forEach(schemas, function (schema) {
[
'get',
'getById',
'getChangesStreaming',
'post',
'patch',
'delete'
].forEach(function (verb) {
const route = server.plugins['hapi-harvester'].routes[verb](schema)
if (_.isArray(route)) {
_.forEach(route, function (route) {
server.route(route)
});
} else {
server.route(route)
}
})
const harvester = server.plugins['hapi-harvester']
_.each(schemas, (schema) => {
_.each(harvester.routes.all(schema), (route) => server.route(route))
})
resolve(server)
})
Expand Down

0 comments on commit 1fd59f4

Please sign in to comment.