ghost-keychain/packages/extension-ui/src/messaging.test.ts
Jaco Greeff 326ba2c1b6
Bump deps (#264)
* Bump deps

* Add appropriate .skip-*'s

* Fix linting

* Format test

* typo :)
2020-03-14 10:42:39 +01:00

28 lines
954 B
TypeScript

// Copyright 2019-2020 @polkadot/extension-ui authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import Adapter from 'enzyme-adapter-react-16';
import { configure } from 'enzyme';
import extensionizer from 'extensionizer';
import { exportAccount } from './messaging';
configure({ adapter: new Adapter() });
describe('messaging sends message to background via extension port for', () => {
test('exportAccount', () => {
const callback = jest.fn();
extensionizer.runtime.connect().onMessage.addListener(callback);
exportAccount('HjoBp62cvsWDA3vtNMWxz6c9q13ReEHi9UGHK7JbZweH5g5', 'passw0rd');
expect(callback).toHaveBeenCalledWith(
expect.objectContaining({
message: 'pri(accounts.export)',
request: { address: 'HjoBp62cvsWDA3vtNMWxz6c9q13ReEHi9UGHK7JbZweH5g5', password: 'passw0rd' }
})
);
});
});