diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-22 09:30:01 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-22 09:30:01 +0900 |
commit | 87ed1f43a96a67c4901c267aee96784de1d45889 (patch) | |
tree | 0ef3182973cad8b54a562cd9e1a34763ea5320c0 /test/background/repositories/version.js | |
parent | a1e5e97200bd96ba918744dfa2758f977ca823c6 (diff) |
Version as Clean Architecture
Diffstat (limited to 'test/background/repositories/version.js')
-rw-r--r-- | test/background/repositories/version.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/background/repositories/version.js b/test/background/repositories/version.js new file mode 100644 index 0000000..8510ae6 --- /dev/null +++ b/test/background/repositories/version.js @@ -0,0 +1,34 @@ +import VersionRepository from 'background/repositories/version'; + +describe("background/repositories/version", () => { + let versionRepository; + + beforeEach(() => { + versionRepository = new VersionRepository; + }); + + describe('#get', () => { + beforeEach(() => { + return browser.storage.local.remove('version'); + }); + + it('loads saved version', async() => { + await browser.storage.local.set({ version: '1.2.3' }); + let version = await this.versionRepository.get(); + expect(version).to.equal('1.2.3'); + }); + + it('returns undefined if no versions in storage', async() => { + let version = await storage.load(); + expect(version).to.be.a('undefined'); + }); + }); + + describe('#update', () => { + it('saves version string', async() => { + await versionRepository.update('2.3.4'); + let { version } = await browser.storage.local.get('version'); + expect(version).to.equal('2.3.4'); + }); + }); +}); |