1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Mock notifier in test

This commit is contained in:
Dan Finlay 2018-06-04 15:26:01 -07:00
parent f07ca73e07
commit ae156e1087
2 changed files with 7 additions and 1 deletions

View File

@ -35,6 +35,7 @@ class PreferencesController {
}, opts.initState)
this.getFirstTimeInfo = opts.getFirstTimeInfo || null
this.notifier = opts.notifier || notifier
this.store = new ObservableStore(initState)
}
@ -129,7 +130,7 @@ class PreferencesController {
// Notify our servers:
const uri = 'https://diagnostics.metamask.io/v1/orphanedAccounts'
const firstTimeInfo = this.getFirstTimeInfo ? this.getFirstTimeInfo() : {}
notifier.notify(uri, {
this.notifier.notify(uri, {
accounts: Object.keys(newlyLost),
metadata: {
version,

View File

@ -72,6 +72,11 @@ describe('MetaMaskController', function () {
it('removes any identities that do not correspond to known accounts.', async function () {
const fakeAddress = '0xbad0'
metamaskController.preferencesController.addAddresses([fakeAddress])
metamaskController.preferencesController.notifier = {
notify: async () => {
return true
},
}
await metamaskController.submitPassword(password)
const identities = Object.keys(metamaskController.preferencesController.store.getState().identities)