mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-02 08:40:08 +01:00
5339344630
* Create sessions sync structure * Add observing to session-syncer * Do not run syncer logic in decorator tests * Extract test constants * Change Observables to BehaviorSubject * Move sendMessage to static method in BrowserApi * Implement session sync * only watch in manifest v3 * Use session sync on folder service * Add array observable sync * Bypass cache on update from message * Create feature and dev flags for browser * Protect development-only methods with decorator * Improve todo comments for long-term residency * Use class properties in init * Do not reuse mocks * Use json (de)serialization patterns * Fix failing session storage in dev environment * Split up complex EncString constructor * Default false for decrypted session storage * Try removing hydrate EncString method * PR review * PR test review
33 lines
507 B
TypeScript
33 lines
507 B
TypeScript
// Add chrome storage api
|
|
const QUOTA_BYTES = 10;
|
|
const storage = {
|
|
local: {
|
|
set: jest.fn(),
|
|
get: jest.fn(),
|
|
remove: jest.fn(),
|
|
QUOTA_BYTES,
|
|
getBytesInUse: jest.fn(),
|
|
clear: jest.fn(),
|
|
},
|
|
session: {
|
|
set: jest.fn(),
|
|
get: jest.fn(),
|
|
has: jest.fn(),
|
|
remove: jest.fn(),
|
|
},
|
|
};
|
|
|
|
const runtime = {
|
|
onMessage: {
|
|
addListener: jest.fn(),
|
|
},
|
|
sendMessage: jest.fn(),
|
|
getManifest: jest.fn(),
|
|
};
|
|
|
|
// set chrome
|
|
global.chrome = {
|
|
storage,
|
|
runtime,
|
|
} as any;
|