ghost-keychain/packages/extension-mocks/src/chromeWrapper.ts
Tarik Gul b6d42c28b5
Transition from manifest v2 to v3 for chrome (#1367)
* Update manifest.json

* replace `extension.getUrl` to `runtime.getUrl`

* Update localStorage to async chrome.storage.local

* Change action to browserAction

* fix bug

* revert async changes

* revert test change

* Fix localStorage breaking change

* .extension -> .runtime

* fix undefined behaviour

* fixed tests

* lint

* Up some callbacks to async

* Change where extractMetadata is called

* fix  in mock

* Update background field to take in type

* Change background.js to service_worker.js

* Update id and request origin for service worker

* updated chrome mock

* 13 tests passing

* Fix async issue

* switch naming back to original

* linting

* Fix linting in base

* remove timeOut

* added permission to alarms in manifest

* fixed alarms uncaught errors

* Cleanup addr for tests

---------

Co-authored-by: bee344 <alberto.penayo@parity.io>
2024-07-07 22:32:42 -04:00

25 lines
612 B
TypeScript

// Copyright 2019-2024 @polkadot/extension-mocks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import sinonChrome from 'sinon-chrome';
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace ChromeWrapper {
export interface IAction {
setBadgeText: (content: object) => Promise<void>;
}
export const action: IAction = {
setBadgeText: (_: object) => {
return new Promise<void>((resolve, _reject) => {
resolve();
});
}
};
}
const extendedSinonChrome = {
...sinonChrome,
action: ChromeWrapper.action
};
export default extendedSinonChrome;