Is there a way to test the chrome.runtime.onInstalled handler? I am developing a Chrome extension that utilizes chrome storage to store specific data. In my upcoming release, I plan on making changes to the data model in chrome storage. To do this effectively, I believe I need to create a migration file that triggers when the old version is updated to the new Chrome version and migrates the data accordingly.
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 intend to employ onInstalled for this purpose as outlined above, but I am keen to explore testing possibilities. Any thoughts or suggestions on how to properly test this functionality would be greatly appreciated. Thanks!