diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-13 22:36:56 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-13 22:36:56 +0900 |
commit | 944dea59199fa03f77e0e7c0d3c02acf8ccb458f (patch) | |
tree | 5f44471cdb32376a8c93e6f6eba738180f08c96f /test/background/shared/versions/index.test.js | |
parent | 77b4e807e2a8b3e7ddb5f042719a34962a31b1c4 (diff) | |
parent | 28bfa3ac8124d3453cd539db26da4f4703e783df (diff) |
Merge remote-tracking branch 'origin/master' into greenkeeper/css-loader-1.0.0
Diffstat (limited to 'test/background/shared/versions/index.test.js')
-rw-r--r-- | test/background/shared/versions/index.test.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/background/shared/versions/index.test.js b/test/background/shared/versions/index.test.js new file mode 100644 index 0000000..d65dd9a --- /dev/null +++ b/test/background/shared/versions/index.test.js @@ -0,0 +1,40 @@ +import * as versions from 'background/shared/versions'; +import manifest from '../../../../manifest.json'; + +describe("shared/versions/storage", () => { + describe('#checkUpdated', () => { + beforeEach(() => { + return browser.storage.local.remove('version'); + }); + + it('return true if no previous versions', async() => { + let updated = await versions.checkUpdated(); + expect(updated).to.be.true; + }); + + it('return true if updated', async() => { + await browser.storage.local.set({ version: '0.001' }); + let updated = await versions.checkUpdated(); + expect(updated).to.be.true; + }); + + 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; + }); + }); + + describe('#commit', () => { + beforeEach(() => { + return browser.storage.local.remove('version'); + }); + + 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); + }); + }); +}); |