|
|
@ -7,32 +7,21 @@ describe("shared/versions/storage", () => { |
|
|
|
return browser.storage.local.remove('version'); |
|
|
|
return browser.storage.local.remove('version'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('return true if no previous versions', () => { |
|
|
|
it('return true if no previous versions', async() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
let updated = await versions.checkUpdated(); |
|
|
|
return versions.checkUpdated(); |
|
|
|
expect(updated).to.be.true; |
|
|
|
}).then((updated) => { |
|
|
|
|
|
|
|
expect(updated).to.be.true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('return true if updated', () => { |
|
|
|
it('return true if updated', async() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
await browser.storage.local.set({ version: '0.001' }); |
|
|
|
return browser.storage.local.set({ version: '0.001' }); |
|
|
|
let updated = await versions.checkUpdated(); |
|
|
|
}).then(() => { |
|
|
|
expect(updated).to.be.true; |
|
|
|
return versions.checkUpdated(); |
|
|
|
|
|
|
|
}).then((updated) => { |
|
|
|
|
|
|
|
expect(updated).to.be.true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('return false if not updated', () => { |
|
|
|
it('return false if not updated', async() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
await browser.storage.local.set({ version: manifest.version }); |
|
|
|
return browser.storage.local.set({ version: manifest.version }); |
|
|
|
let updated = await versions.checkUpdated(); |
|
|
|
}).then(() => { |
|
|
|
expect(updated).to.be.false; |
|
|
|
return versions.checkUpdated(); |
|
|
|
|
|
|
|
}).then((updated) => { |
|
|
|
|
|
|
|
expect(updated).to.be.false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -41,15 +30,11 @@ describe("shared/versions/storage", () => { |
|
|
|
return browser.storage.local.remove('version'); |
|
|
|
return browser.storage.local.remove('version'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('saves current version from manifest.json', () => { |
|
|
|
it('saves current version from manifest.json', async() => { |
|
|
|
return Promise.resolve().then(() => { |
|
|
|
await versions.commit(); |
|
|
|
return versions.commit(); |
|
|
|
let { version } = await browser.storage.local.get('version'); |
|
|
|
}).then(() => { |
|
|
|
expect(version).to.be.a('string'); |
|
|
|
return browser.storage.local.get('version'); |
|
|
|
expect(version).to.equal(manifest.version); |
|
|
|
}).then(({version}) => { |
|
|
|
|
|
|
|
expect(version).to.be.a('string'); |
|
|
|
|
|
|
|
expect(version).to.equal(manifest.version); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|