diff --git a/routes/accounts.js b/routes/accounts.js index 336c2c0..f43df32 100644 --- a/routes/accounts.js +++ b/routes/accounts.js @@ -233,7 +233,11 @@ function accountRoutes (server, options, next) { }) .then(function (json) { - reply(json).code(201) + if (profile) { + reply(json).code(201) + } else { + reply(json).code(204) + } }) .catch(function (error) { diff --git a/tests/integration/routes/accounts/patch-accounts-test.js b/tests/integration/routes/accounts/patch-accounts-test.js index 273a251..299263e 100644 --- a/tests/integration/routes/accounts/patch-accounts-test.js +++ b/tests/integration/routes/accounts/patch-accounts-test.js @@ -168,9 +168,8 @@ getServer(function (error, server) { server.inject(routeOptions, function (response) { t.is(couchdb.pendingMocks()[0], undefined, 'all mocks satisfied') - delete response.result.meta - t.is(response.statusCode, 201, 'returns 201 status') - t.is(response.result.data.attributes.username, 'pat-doe', 'returns the right content') + t.is(response.statusCode, 204, 'returns 204 status') + t.is(response.result, null, 'returns no content') t.end() }) })