diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2019-03-01 16:21:11 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2019-03-01 16:45:51 +0100 |
| commit | 631f7f0981961a046401d8cf217b19ca4ea2f2b0 (patch) | |
| tree | 4cf192b84879aa71d83e6a993efe08d618c40f5b /gui/test | |
| parent | ac728cbef306c08698c66c3e3f1515e8cb636ea3 (diff) | |
| download | mullvadvpn-631f7f0981961a046401d8cf217b19ca4ea2f2b0.tar.xz mullvadvpn-631f7f0981961a046401d8cf217b19ca4ea2f2b0.zip | |
Convert AuthFailure to Error subclass and dynamically query gettext strings
Diffstat (limited to 'gui/test')
| -rw-r--r-- | gui/test/auth-failure.spec.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gui/test/auth-failure.spec.ts b/gui/test/auth-failure.spec.ts index 4d1ad75b25..6bb643c345 100644 --- a/gui/test/auth-failure.spec.ts +++ b/gui/test/auth-failure.spec.ts @@ -1,27 +1,27 @@ import { expect } from 'chai'; import { it, describe } from 'mocha'; -import { AuthFailure } from '../src/renderer/lib/auth-failure'; +import { AuthFailureError, AuthFailureKind } from '../src/renderer/lib/auth-failure'; describe('auth_failed parsing', () => { it('invalid line parsing works', () => { - const auth_msg = new AuthFailure('invalid auth_failed message'); - expect(auth_msg._reasonId).to.be.eql('UNKNOWN'); - expect(auth_msg.show()).to.be.eql('invalid auth_failed message'); + const auth_msg = new AuthFailureError('invalid auth_failed message'); + expect(auth_msg.kind).to.be.equal(AuthFailureKind.unknown); + expect(auth_msg.message).to.be.equal('invalid auth_failed message'); }); it('valid unknown works', () => { - const auth_msg = new AuthFailure('[valid_unknown] Message'); - expect(auth_msg._reasonId).to.be.eql('UNKNOWN'); - expect(auth_msg.show()).to.be.eql('Message'); + const auth_msg = new AuthFailureError('[valid_unknown] Message'); + expect(auth_msg.kind).to.be.equal(AuthFailureKind.unknown); + expect(auth_msg.message).to.be.equal('Message'); }); it('valid known works', () => { - const auth_msg = new AuthFailure('[INVALID_ACCOUNT] Invalid account'); - expect(auth_msg._reasonId).to.be.eql('INVALID_ACCOUNT'); + const auth_msg = new AuthFailureError('[INVALID_ACCOUNT] Invalid account'); + expect(auth_msg.kind).to.be.equal(AuthFailureKind.invalidAccount); }); it('empty message works', () => { - const auth_msg = new AuthFailure('[INVALID_ACCOUNT]'); - expect(auth_msg._reasonId).to.be.eql('INVALID_ACCOUNT'); + const auth_msg = new AuthFailureError('[INVALID_ACCOUNT]'); + expect(auth_msg.kind).to.be.equal(AuthFailureKind.invalidAccount); }); }); |
