aboutsummaryrefslogtreecommitdiff
path: root/test/content/repositories
diff options
context:
space:
mode:
Diffstat (limited to 'test/content/repositories')
-rw-r--r--test/content/repositories/KeymapRepository.test.ts24
-rw-r--r--test/content/repositories/SettingRepository.test.ts8
2 files changed, 17 insertions, 15 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);
});
});
diff --git a/test/content/repositories/SettingRepository.test.ts b/test/content/repositories/SettingRepository.test.ts
index fea70b7..db4c528 100644
--- a/test/content/repositories/SettingRepository.test.ts
+++ b/test/content/repositories/SettingRepository.test.ts
@@ -1,13 +1,14 @@
import { SettingRepositoryImpl } from '../../../src/content/repositories/SettingRepository';
import { expect } from 'chai';
+import Settings from '../../../src/shared/settings/Settings';
describe('SettingRepositoryImpl', () => {
it('updates and gets current value', () => {
let sut = new SettingRepositoryImpl();
- let settings = {
+ let settings = Settings.fromJSON({
keymaps: {},
- search: {
+ search:{
default: 'google',
engines: {
google: 'https://google.com/?q={}',
@@ -19,7 +20,7 @@ describe('SettingRepositoryImpl', () => {
complete: 'sbh',
},
blacklist: [],
- }
+ });
sut.set(settings);
@@ -27,4 +28,3 @@ describe('SettingRepositoryImpl', () => {
expect(actual.properties.hintchars).to.equal('abcd1234');
});
});
-