diff options
| author | Andrej Mihajlov <and@codeispoetry.ru> | 2017-03-10 18:49:16 +0000 |
|---|---|---|
| committer | Andrej Mihajlov <and@codeispoetry.ru> | 2017-03-10 18:49:16 +0000 |
| commit | ab936cc298a81dbf0ef13e53bd03cff7f2324d13 (patch) | |
| tree | 9aea6453b22ffa3948a16c6fb6171ecaa321ba7f /test | |
| parent | 767148f976f942bb68d4bc6c4d09b076aa6e39e0 (diff) | |
| download | mullvadvpn-ab936cc298a81dbf0ef13e53bd03cff7f2324d13.tar.xz mullvadvpn-ab936cc298a81dbf0ef13e53bd03cff7f2324d13.zip | |
Update documentation
Diffstat (limited to 'test')
| -rw-r--r-- | test/enum.spec.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/enum.spec.js b/test/enum.spec.js index dec15b219c..554a35b922 100644 --- a/test/enum.spec.js +++ b/test/enum.spec.js @@ -3,20 +3,26 @@ import Enum from '../app/lib/enum'; describe('enum', () => { it('should be able to compare values', () => { - const e = Enum('NORTH', 'SOUTH', 'WEST', 'EAST'); + const e = new Enum('NORTH', 'SOUTH', 'WEST', 'EAST'); expect(e.NORTH).to.be.equal('NORTH'); }); it('should not be able to modify enum', () => { - let e = Enum('NORTH', 'SOUTH', 'WEST', 'EAST'); + const e = new Enum('NORTH', 'SOUTH', 'WEST', 'EAST'); expect(() => e.ANYWHERE = 'ANYWHERE').to.throw(); }); it('should be able to validate enum keys', () => { - let e = Enum('NORTH', 'SOUTH', 'WEST', 'EAST'); + const e = new Enum('NORTH', 'SOUTH', 'WEST', 'EAST'); expect(e.isValid('SOUTH')).to.be.true; expect(e.isValid('ANYWHERE')).to.be.false; expect(e.isValid()).to.be.false; expect(e.isValid(null)).to.be.false; }); + + it('should receive correct keys from Object.keys', () => { + const keys = ['NORTH', 'SOUTH', 'WEST', 'EAST']; + const e = new Enum(...keys); + expect(Object.keys(e)).to.be.deep.equal(keys); + }); }); |
