Skip to content

Commit f13d2d8

Browse files
author
Jordan Upiter
committed
Added test for bad validation route
1 parent 7e3e6a0 commit f13d2d8

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Diff for: test/docsSpec.js

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ describe('koa-resourcer-docs', function() {
115115
assert(html.indexOf('Overridden') === -1);
116116
assert(html.indexOf('commanding') > 0);
117117
});
118+
119+
it('should not throw when a validate attribute is undefined', function* () {
120+
assert(html.indexOf('/badvalidate') > 0);
121+
});
118122
});
119123
});
120124

Diff for: test/resources/router/partial/partial.js

+14
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ r.get('/visible',
2525
}
2626
);
2727

28+
r.get('/badvalidate',
29+
{
30+
meta: {
31+
description: 'Route with an undefined validate attribute'
32+
},
33+
validate: {
34+
body: undefined
35+
}
36+
},
37+
function* () {
38+
this.body = 'This should not throw an error!';
39+
}
40+
);
41+
2842
r.get('/hidden',
2943
{
3044
meta: {

0 commit comments

Comments
 (0)