I would like to know if there is a way to test the chrome.runtime.onInstalled handler. Basically I'm working on a chrome extension that uses the chrome storage to save certain data in memory. However in my new release version I would like to make changes to the data model of the chrome storage. For that reason I guess I need to write a migration file that fires when the old version is updated to the new chrome version und migrate the data.
chrome.runtime.onInstalled.addListener((details => {
if (details.reason === 'update') {
console.debug(`Upgrading from version ${details.previousVersion}`)
const previousVersion = parseVersion(details.previousVersion || '0.0.0')
if (compareVersions(previousVersion, [1, 1, 0]) <= 0) {
upgradeFrom1_1_0()
}
}
}))
I want to use onInstalled for this something like above, but I wonder if there is any way I can properly test this. Does anyone have an idea? Any suggestions are appreciated, thanks!