Skip to content

Commit 185a47e

Browse files
committed
fix(endpoint:test): fix PUT test for upsert
1 parent da19380 commit 185a47e

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

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

+21-3
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,27 @@ describe('<%= classedName %> API:', function() {
105105
updated<%= classedName %> = {};
106106
});
107107

108-
it('should respond with the updated <%= cameledName %>', function() {
109-
<%= expect() %>updated<%= classedName %>.name<%= to() %>.equal('Updated <%= classedName %>');
110-
<%= expect() %>updated<%= classedName %>.info<%= to() %>.equal('This is the updated <%= cameledName %>!!!');
108+
it('should respond with the original <%= cameledName %>', function() {
109+
<%= expect() %>updated<%= classedName %>.name<%= to() %>.equal('New <%= classedName %>');
110+
<%= expect() %>updated<%= classedName %>.info<%= to() %>.equal('This is the brand new <%= cameledName %>!!!');
111+
});
112+
113+
it('should respond with the updated <%= cameledName %> on a subsequent GET', function(done) {
114+
request(app)
115+
.get('<%= route %>/' + new<%= classedName %>._id)
116+
.expect(200)
117+
.expect('Content-Type', /json/)
118+
.end((err, res) => {
119+
if(err) {
120+
return done(err);
121+
}
122+
let <%= cameledName %> = res.body;
123+
124+
<%= expect() %><%= cameledName %>.name<%= to() %>.equal('Updated <%= classedName %>');
125+
<%= expect() %><%= cameledName %>.info<%= to() %>.equal('This is the updated <%= cameledName %>!!!');
126+
127+
done();
128+
});
111129
});
112130
});
113131

0 commit comments

Comments
 (0)