aboutsummaryrefslogtreecommitdiff
path: root/test/background/shared/versions/storage.test.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-07-11 21:01:48 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-07-11 21:01:48 +0900
commit067da88d06fbffca323ecdbaf8b1011f88225219 (patch)
tree3aab1472374310a5b724f1b7d08a7ab465a7718d /test/background/shared/versions/storage.test.js
parentb69cc04856fd21d325193d56e212e4dbf07cb762 (diff)
Move versions to background
Diffstat (limited to 'test/background/shared/versions/storage.test.js')
-rw-r--r--test/background/shared/versions/storage.test.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/background/shared/versions/storage.test.js b/test/background/shared/versions/storage.test.js
new file mode 100644
index 0000000..f452516
--- /dev/null
+++ b/test/background/shared/versions/storage.test.js
@@ -0,0 +1,28 @@
+import * as storage from 'background/shared/versions/storage';
+
+describe("shared/versions/storage", () => {
+ describe('#load', () => {
+ beforeEach(() => {
+ return browser.storage.local.remove('version');
+ });
+
+ it('loads saved version', async() => {
+ await browser.storage.local.set({ version: '1.2.3' });
+ let version = await storage.load();
+ 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('#save', () => {
+ it('saves version string', async() => {
+ await storage.save('2.3.4');
+ let { version } = await browser.storage.local.get('version');
+ expect(version).to.equal('2.3.4');
+ });
+ });
+});