mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-20 21:01:29 +01:00
fix browser state service tests
This commit is contained in:
parent
e66ae53bf9
commit
6068421df7
@ -41,7 +41,8 @@ describe("Browser State Service", () => {
|
||||
logService = mock();
|
||||
stateMigrationService = mock();
|
||||
stateFactory = mock();
|
||||
useAccountCache = true;
|
||||
// turn off account cache for tests
|
||||
useAccountCache = false;
|
||||
|
||||
state = new State(new GlobalState());
|
||||
state.accounts[userId] = new Account({
|
||||
|
@ -58,15 +58,17 @@ export class BrowserStateService
|
||||
// TODO: This is a hack to fix having a disk cache on both the popup and
|
||||
// the background page that can get out of sync. We need to have a single
|
||||
// instance of our state service that is shared so we can remove this.
|
||||
chrome.storage.onChanged.addListener((changes, namespace) => {
|
||||
if (namespace === "local") {
|
||||
for (const key of Object.keys(changes)) {
|
||||
if (key !== "accountActivity" && this.accountDiskCache.value[key]) {
|
||||
this.deleteDiskCache(key);
|
||||
if (useAccountCache) {
|
||||
chrome.storage.onChanged.addListener((changes, namespace) => {
|
||||
if (namespace === "local") {
|
||||
for (const key of Object.keys(changes)) {
|
||||
if (key !== "accountActivity" && this.accountDiskCache.value[key]) {
|
||||
this.deleteDiskCache(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async addAccount(account: Account) {
|
||||
|
Loading…
Reference in New Issue
Block a user