Skip to content

Commit

Permalink
Merge pull request #295 from nypublicradio/mhearn/conditional-member-…
Browse files Browse the repository at this point in the history
…center-error-message

Catch 500 error on orders API + failing message test
  • Loading branch information
mike-hearn authored Dec 16, 2020
2 parents f2c7b97 + 0d497fc commit 893f730
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/routes/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default Route.extend(AuthenticatedRouteMixin, {
return this.get('currentUser.user');
},
setupController(controller, model) {
controller.set('orders', this.store.findAll('order'));
controller.set('orders', this.store.findAll('order')).catch(e => e);
controller.send('updateEmailStatus', get(model, 'email'));
return this._super(controller, model);
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"loader.js": "^4.2.3",
"morgan": "^1.6.1",
"normalize.css": "^8.0.0",
"nypr-account-settings": "~0.2.7",
"nypr-account-settings": "~0.3.1",
"nypr-ads": "~0.1.0",
"nypr-audio-services": ">=0.5.6",
"nypr-auth": ">=0.2.3",
Expand Down
10 changes: 10 additions & 0 deletions tests/acceptance/profile-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,14 @@ module('Acceptance | profile', function(hooks) {
assert.equal(setTempPasswordRequests.length, 1, 'it should call the send-temp api url once');
assert.equal(JSON.parse(setTempPasswordRequests[0].requestBody).email, user.email, 'it should call the send-temp api url with the users email address');
});

test('test member center failure', async function(assert) {
authenticateSession({access_token: 'foo'});
server.create('user');
server.get('/v1/orders/', {}, 500);

await visit('/profile');

assert.ok(find('.nypr-membership-info-body').textContent.includes("membership details could not be retrieved"));
});
});
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9246,10 +9246,10 @@ nwsapi@^2.0.9:
resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7"
integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==

nypr-account-settings@~0.2.7:
version "0.2.7"
resolved "https://registry.yarnpkg.com/nypr-account-settings/-/nypr-account-settings-0.2.7.tgz#fc9b43d3dbf593036f1002a15d942adb9335e97f"
integrity sha512-9vg0XSKmTBfy50AjPfYxYftu+YZAbuE9rfPJkkXAwHMDwtHb/hjFYAqRVoQmvtci4Ys1vlNbXiVP5yOjibkbDg==
nypr-account-settings@~0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/nypr-account-settings/-/nypr-account-settings-0.3.1.tgz#718fc40039390703ba2c33cfdd7c0508b76b560f"
integrity sha512-h4crv9SydMaqz3XGj5IQ706w0/5uT1uksOayxmhlE8B54vnNtd0yYS14F1C/Wrw0BmxWayWAgBt8gH9OGIZc7g==
dependencies:
ember-changeset "^2.0.0"
ember-changeset-validations "^2.1.0"
Expand Down

0 comments on commit 893f730

Please sign in to comment.