Skip to content

Commit

Permalink
[uiSettings] correct test cases after moving from 401 -> 403
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Nov 23, 2016
1 parent 65b1e0a commit c2c7fdb
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/ui/settings/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ describe('ui settings', function () {
expect(await uiSettings.getUserProvided(req)).to.eql({});
});

it('returns an empty object on 401 responses', async function () {
it('returns an empty object on 403 responses', async function () {
const { uiSettings, req } = instantiate({
async callWithRequest() {
throw new esErrors[401]();
throw new esErrors[403]();
}
});

Expand All @@ -188,6 +188,21 @@ describe('ui settings', function () {
expect(await uiSettings.getUserProvided(req)).to.eql({});
});

it('throws 401 errors', async function () {
const { uiSettings, req } = instantiate({
async callWithRequest() {
throw new esErrors[401]();
}
});

try {
await uiSettings.getUserProvided(req);
throw new Error('expect getUserProvided() to throw');
} catch (err) {
expect(err).to.be.a(esErrors[401]);
}
});

it('throw when callWithRequest fails in some unexpected way', async function () {
const expectedUnexpectedError = new Error('unexpected');

Expand Down

0 comments on commit c2c7fdb

Please sign in to comment.