aboutsummaryrefslogtreecommitdiff
path: root/test/content/repositories/KeymapRepository.test.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-10-07 12:54:32 +0000
committerGitHub <noreply@github.com>2019-10-07 12:54:32 +0000
commit8eddcc1785a85bbe74be254d1055ebe5125dad10 (patch)
treef3f51320d12a90a1b421ed8b1f811c576996ea8e /test/content/repositories/KeymapRepository.test.ts
parent7fc2bb615f530fc6adfade54b9553568f5d50ceb (diff)
parentb77a4734985722e96066e713f3b1b9e81a6e1811 (diff)
Merge pull request #654 from ueokande/settings-as-a-class
Refactor settings on shared logics
Diffstat (limited to 'test/content/repositories/KeymapRepository.test.ts')
-rw-r--r--test/content/repositories/KeymapRepository.test.ts24
1 files changed, 13 insertions, 11 deletions
diff --git a/test/content/repositories/KeymapRepository.test.ts b/test/content/repositories/KeymapRepository.test.ts
index 34704d9..df013df 100644
--- a/test/content/repositories/KeymapRepository.test.ts
+++ b/test/content/repositories/KeymapRepository.test.ts
@@ -1,6 +1,7 @@
import KeymapRepository, { KeymapRepositoryImpl }
from '../../../src/content/repositories/KeymapRepository';
import { expect } from 'chai';
+import Key from "../../../src/shared/settings/Key";
describe('KeymapRepositoryImpl', () => {
let sut: KeymapRepository;
@@ -11,24 +12,25 @@ describe('KeymapRepositoryImpl', () => {
describe('#enqueueKey()', () => {
it('enqueues keys', () => {
- sut.enqueueKey({ key: 'a' });
- sut.enqueueKey({ key: 'b' });
- let sequence = sut.enqueueKey({ key: 'c' });
-
- expect(sequence.getKeyArray()).deep.equals([
- { key: 'a' }, { key: 'b' }, { key: 'c' },
- ]);
+ sut.enqueueKey(Key.fromMapKey('a');
+ sut.enqueueKey(Key.fromMapKey('b');
+ let sequence = sut.enqueueKey(Key.fromMapKey('c'));
+
+ let keys = sequence.keys;
+ expect(keys[0].equals(Key.fromMapKey('a'))).to.be.true;
+ expect(keys[1].equals(Key.fromMapKey('b'))).to.be.true;
+ expect(keys[2].equals(Key.fromMapKey('c'))).to.be.true;
});
});
describe('#clear()', () => {
it('clears keys', () => {
- sut.enqueueKey({ key: 'a' });
- sut.enqueueKey({ key: 'b' });
- sut.enqueueKey({ key: 'c' });
+ sut.enqueueKey(Key.fromMapKey('a'));
+ sut.enqueueKey(Key.fromMapKey('b'));
+ sut.enqueueKey(Key.fromMapKey('c'));
sut.clear();
- let sequence = sut.enqueueKey({ key: 'a' });
+ let sequence = sut.enqueueKey(Key.fromMapKey('a'));
expect(sequence.length()).to.equal(1);
});
});