Skip to content

Commit efb69f3

Browse files
committed
test(endpoint): add integration test for PATCH
1 parent 185a47e commit efb69f3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Diff for: templates/endpoint/basename.integration.js

+31
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,37 @@ describe('<%= classedName %> API:', function() {
129129
});
130130
});
131131

132+
describe('PATCH <%= route %>/:id', function() {
133+
var patched<%= classedName %>;
134+
135+
beforeEach(function(done) {
136+
request(app)
137+
.patch('<%= route %>/' + new<%= classedName %>._id)
138+
.send([
139+
{ "op": "replace", "path": "/name", value: 'Patched <%= classedName %>' },
140+
{ "op": "replace", "path": "/info", value: 'This is the patched <%= cameledName %>!!!' }
141+
])
142+
.expect(200)
143+
.expect('Content-Type', /json/)
144+
.end(function(err, res) {
145+
if(err) {
146+
return done(err);
147+
}
148+
patched<%= classedName %> = res.body;
149+
done();
150+
});
151+
});
152+
153+
afterEach(function() {
154+
patched<%= classedName %> = {};
155+
});
156+
157+
it('should respond with the patched <%= cameledName %>', function() {
158+
<%= expect() %>patched<%= classedName %>.name<%= to() %>.equal('Patched <%= classedName %>');
159+
<%= expect() %>patched<%= classedName %>.info<%= to() %>.equal('This is the patched <%= cameledName %>!!!');
160+
});
161+
});
162+
132163
describe('DELETE <%= route %>/:id', function() {
133164
it('should respond with 204 on successful removal', function(done) {
134165
request(app)

0 commit comments

Comments
 (0)