Implement the auth test differently to not use assert.rejects

This commit is contained in:
Tyler Leonhardt 2021-07-20 17:26:44 -07:00
parent 76205395d5
commit e4fa4063da
No known key found for this signature in database
GPG key ID: 1BC2B6244363E77E

View file

@ -153,10 +153,15 @@ suite('MainThreadAuthentication', () => {
});
test('Can not recreate a session if none exists', async () => {
await assert.rejects(() => mainThreadAuthentication.$getSession('empty', ['foo'], 'testextension', 'test extension', {
createIfNone: false,
clearSessionPreference: false,
forceRecreate: true
}), new Error('No existing sessions found.'));
try {
await mainThreadAuthentication.$getSession('empty', ['foo'], 'testextension', 'test extension', {
createIfNone: false,
clearSessionPreference: false,
forceRecreate: true
});
assert.fail('should have thrown an Error.');
} catch (e) {
assert.strictEqual(e.message, 'No existing sessions found.');
}
});
});