-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(BuySell): indicate quote changes to user
- Loading branch information
1 parent
65da9a3
commit d56181a
Showing
28 changed files
with
1,117 additions
and
120 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 @@ | ||
import '@testing-library/jest-dom' |
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
54 changes: 54 additions & 0 deletions
54
packages/blockchain-wallet-v4-frontend/src/data/components/buySell/selectors.test.ts
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 Remote from '@core/remote' | ||
import { getBuyQuoteMemoizedByOrder } from 'data/components/buySell/selectors' | ||
import { RootState } from 'data/rootReducer' | ||
|
||
describe('buySell selectors', () => { | ||
describe('getBuyQuoteMemoizedByOrder', () => { | ||
const OLD_QUOTE = Remote.Success({ | ||
quote: { | ||
quoteId: 'old-quote' | ||
} | ||
}) | ||
const OLD_ORDER = Remote.Success({ | ||
id: 'old-order' | ||
}) | ||
|
||
const NEW_QUOTE = Remote.Success({ | ||
quote: { | ||
quoteId: 'new-quote' | ||
} | ||
}) | ||
const NEW_ORDER = Remote.Success({ | ||
id: 'new-order' | ||
}) | ||
const makeState = (buyQuote: typeof OLD_QUOTE, order: typeof OLD_ORDER) => | ||
({ | ||
components: { | ||
buySell: { | ||
buyQuote, | ||
order | ||
} | ||
} | ||
} as RootState) | ||
|
||
describe('when cache is empty', () => { | ||
it('should return up to date quote', () => { | ||
expect(getBuyQuoteMemoizedByOrder(makeState(OLD_QUOTE, OLD_ORDER))).toBe(OLD_QUOTE) | ||
}) | ||
}) | ||
|
||
describe('when quote changed but order is the same', () => { | ||
it('should return cached quote', () => { | ||
expect(getBuyQuoteMemoizedByOrder(makeState(NEW_QUOTE, OLD_ORDER))).toBe(OLD_QUOTE) | ||
}) | ||
}) | ||
|
||
describe('when both quote and order changed', () => { | ||
it('should return new quote', () => { | ||
expect(getBuyQuoteMemoizedByOrder(makeState(NEW_QUOTE, NEW_ORDER))).toBe(NEW_QUOTE) | ||
}) | ||
}) | ||
}) | ||
|
||
it.todo('other selectors') | ||
}) |
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.