-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #469 from HathorNetwork/release-candidate
Release v0.30.0
- Loading branch information
Showing
26 changed files
with
703 additions
and
163 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
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
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
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,54 @@ | ||
import hathorLib from '@hathor/wallet-lib'; | ||
import TestUtils from './test-utils'; | ||
import settings from '../src/settings'; | ||
import { initializedWallets } from '../src/services/wallets.service'; | ||
|
||
const walletId = 'stub_history_sync'; | ||
|
||
describe('history sync', () => { | ||
afterEach(async () => { | ||
await TestUtils.stopWallet({ walletId }); | ||
}); | ||
|
||
it('should start a wallet with default http polling if not configured', async () => { | ||
const response = await TestUtils.request | ||
.post('/start') | ||
.send({ seedKey: TestUtils.seedKey, 'wallet-id': walletId }); | ||
expect(response.status).toBe(200); | ||
expect(response.body.success).toBe(true); | ||
const wallet = initializedWallets.get(walletId); | ||
expect(wallet.historySyncMode).toEqual(hathorLib.HistorySyncMode.POLLING_HTTP_API); | ||
}); | ||
|
||
it('should start a wallet with configured history sync', async () => { | ||
const config = settings._getDefaultConfig(); | ||
config.history_sync_mode = 'manual_stream_ws'; | ||
settings._setConfig(config); | ||
const response = await TestUtils.request | ||
.post('/start') | ||
.send({ seedKey: TestUtils.seedKey, 'wallet-id': walletId }); | ||
settings._resetConfig(); | ||
expect(response.status).toBe(200); | ||
expect(response.body.success).toBe(true); | ||
const wallet = initializedWallets.get(walletId); | ||
expect(wallet.historySyncMode).toEqual(hathorLib.HistorySyncMode.MANUAL_STREAM_WS); | ||
}); | ||
|
||
it('should use the history sync from the request when provided', async () => { | ||
const config = settings._getDefaultConfig(); | ||
config.history_sync_mode = 'manual_stream_ws'; | ||
settings._setConfig(config); | ||
const response = await TestUtils.request | ||
.post('/start') | ||
.send({ | ||
seedKey: TestUtils.seedKey, | ||
'wallet-id': walletId, | ||
history_sync_mode: 'xpub_stream_ws', | ||
}); | ||
settings._resetConfig(); | ||
expect(response.status).toBe(200); | ||
expect(response.body.success).toBe(true); | ||
const wallet = initializedWallets.get(walletId); | ||
expect(wallet.historySyncMode).toEqual(hathorLib.HistorySyncMode.XPUB_STREAM_WS); | ||
}); | ||
}); |
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
Oops, something went wrong.