-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(connect): keepSession with changing useCardanoDerivation
- Loading branch information
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import TrezorConnect from '../../../src'; | ||
|
||
import { getController, setup, conditionalTest, initTrezorConnect } from '../../common.setup'; | ||
|
||
const controller = getController(); | ||
|
||
describe('keepSession common param', () => { | ||
beforeAll(async () => { | ||
await TrezorConnect.dispose(); | ||
await setup(controller, { | ||
mnemonic: 'mnemonic_all', | ||
}); | ||
await initTrezorConnect(controller); | ||
}); | ||
|
||
afterAll(async () => { | ||
controller.dispose(); | ||
await TrezorConnect.dispose(); | ||
}); | ||
|
||
conditionalTest(['1', '<2.3.2'], 'keepSession with changing useCardanoDerivation', async () => { | ||
const noDerivation = await TrezorConnect.getAccountDescriptor({ | ||
coin: 'ada', | ||
path: "m/1852'/1815'/0'/0/0", | ||
useCardanoDerivation: false, | ||
keepSession: true, | ||
}); | ||
if (noDerivation.success) throw new Error('noDerivation should not succeed'); | ||
expect(noDerivation.payload.error).toBe( | ||
'Cardano derivation is not enabled for this session', | ||
); | ||
|
||
const enableDerivation = await TrezorConnect.getAccountDescriptor({ | ||
coin: 'ada', | ||
path: "m/1852'/1815'/0'/0/0", | ||
useCardanoDerivation: true, | ||
keepSession: true, | ||
}); | ||
if (!enableDerivation.success) throw new Error(enableDerivation.payload.error); | ||
expect(enableDerivation.payload.descriptor).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters