A fork of https://github.com/ueokande/vim-vixen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
958 B
35 lines
958 B
6 years ago
|
import VersionRepository from 'background/repositories/Version';
|
||
7 years ago
|
|
||
6 years ago
|
describe("background/repositories/version", () => {
|
||
|
let versionRepository;
|
||
|
|
||
|
beforeEach(() => {
|
||
|
versionRepository = new VersionRepository;
|
||
|
});
|
||
|
|
||
|
describe('#get', () => {
|
||
7 years ago
|
beforeEach(() => {
|
||
|
return browser.storage.local.remove('version');
|
||
|
});
|
||
|
|
||
6 years ago
|
it('loads saved version', async() => {
|
||
|
await browser.storage.local.set({ version: '1.2.3' });
|
||
6 years ago
|
let version = await this.versionRepository.get();
|
||
6 years ago
|
expect(version).to.equal('1.2.3');
|
||
7 years ago
|
});
|
||
|
|
||
6 years ago
|
it('returns undefined if no versions in storage', async() => {
|
||
|
let version = await storage.load();
|
||
|
expect(version).to.be.a('undefined');
|
||
7 years ago
|
});
|
||
|
});
|
||
|
|
||
6 years ago
|
describe('#update', () => {
|
||
6 years ago
|
it('saves version string', async() => {
|
||
6 years ago
|
await versionRepository.update('2.3.4');
|
||
6 years ago
|
let { version } = await browser.storage.local.get('version');
|
||
|
expect(version).to.equal('2.3.4');
|
||
7 years ago
|
});
|
||
|
});
|
||
|
});
|