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.
41 lines
1.2 KiB
41 lines
1.2 KiB
6 years ago
|
import * as versions from 'background/shared/versions';
|
||
|
import manifest from '../../../../manifest.json';
|
||
7 years ago
|
|
||
|
describe("shared/versions/storage", () => {
|
||
|
describe('#checkUpdated', () => {
|
||
|
beforeEach(() => {
|
||
|
return browser.storage.local.remove('version');
|
||
|
});
|
||
|
|
||
7 years ago
|
it('return true if no previous versions', async() => {
|
||
|
let updated = await versions.checkUpdated();
|
||
|
expect(updated).to.be.true;
|
||
7 years ago
|
});
|
||
|
|
||
7 years ago
|
it('return true if updated', async() => {
|
||
|
await browser.storage.local.set({ version: '0.001' });
|
||
|
let updated = await versions.checkUpdated();
|
||
|
expect(updated).to.be.true;
|
||
7 years ago
|
});
|
||
|
|
||
7 years ago
|
it('return false if not updated', async() => {
|
||
|
await browser.storage.local.set({ version: manifest.version });
|
||
|
let updated = await versions.checkUpdated();
|
||
|
expect(updated).to.be.false;
|
||
7 years ago
|
});
|
||
|
});
|
||
|
|
||
|
describe('#commit', () => {
|
||
|
beforeEach(() => {
|
||
|
return browser.storage.local.remove('version');
|
||
|
});
|
||
|
|
||
7 years ago
|
it('saves current version from manifest.json', async() => {
|
||
|
await versions.commit();
|
||
|
let { version } = await browser.storage.local.get('version');
|
||
|
expect(version).to.be.a('string');
|
||
|
expect(version).to.equal(manifest.version);
|
||
7 years ago
|
});
|
||
|
});
|
||
|
});
|