Chore: Split settlement asset into separate market info section (#1028)

* chore: split settlement asset into seperate market info section

* fix:  market-info.cy.ts test

* fix: market-info.cy.ts

Co-authored-by: Madalina Raicu <madalina@vegaprotocol.io>
This commit is contained in:
PeteWilliams 2022-08-12 17:49:27 +01:00 committed by GitHub
parent a59971df28
commit c8bd9828a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 8 deletions

View File

@ -43,7 +43,7 @@ describe('market info is displayed', () => {
validateMarketDataRow(2, 'Position Decimal Places', '0'); validateMarketDataRow(2, 'Position Decimal Places', '0');
validateMarketDataRow(3, 'Trading Mode', 'Continuous'); validateMarketDataRow(3, 'Trading Mode', 'Continuous');
validateMarketDataRow(4, 'State', 'Active'); validateMarketDataRow(4, 'State', 'Active');
validateMarketDataRow(5, 'Market Id', 'market-0'); validateMarketDataRow(5, 'Market ID', 'market-0');
}); });
it('instrument displayed', () => { it('instrument displayed', () => {
@ -53,13 +53,18 @@ describe('market info is displayed', () => {
validateMarketDataRow(1, 'Code', 'BTCUSD.MF21'); validateMarketDataRow(1, 'Code', 'BTCUSD.MF21');
validateMarketDataRow(2, 'Product Type', 'Future'); validateMarketDataRow(2, 'Product Type', 'Future');
validateMarketDataRow(3, 'Quote Name', 'BTC'); validateMarketDataRow(3, 'Quote Name', 'BTC');
});
it('settlement asset displayed', () => {
cy.getByTestId(marketTitle).contains('Settlement asset').click();
validateMarketDataRow(0, 'Name', 'tBTC TEST');
validateMarketDataRow(1, 'Symbol', 'tBTC');
validateMarketDataRow( validateMarketDataRow(
4, 2,
'Id', 'ID',
'5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c' '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c'
); );
validateMarketDataRow(5, 'Symbol', 'tBTC');
validateMarketDataRow(6, 'Name', 'tBTC TEST');
}); });
it('metadata displayed', () => { it('metadata displayed', () => {

View File

@ -219,7 +219,7 @@ export const Info = ({ market }: InfoProps) => {
<MarketInfoTable <MarketInfoTable
data={{ data={{
...keyDetails, ...keyDetails,
marketId: keyDetails.id, marketID: keyDetails.id,
id: undefined, id: undefined,
tradingMode: tradingMode:
keyDetails.tradingMode && formatLabel(keyDetails.tradingMode), keyDetails.tradingMode && formatLabel(keyDetails.tradingMode),
@ -237,8 +237,22 @@ export const Info = ({ market }: InfoProps) => {
productType: productType:
market.tradableInstrument.instrument.product.__typename, market.tradableInstrument.instrument.product.__typename,
...market.tradableInstrument.instrument.product, ...market.tradableInstrument.instrument.product,
...(market.tradableInstrument.instrument.product?.settlementAsset ?? }}
{}), />
),
},
{
title: t('Settlement asset'),
content: (
<MarketInfoTable
data={{
name: market.tradableInstrument.instrument.product?.settlementAsset
.name,
symbol:
market.tradableInstrument.instrument.product?.settlementAsset
.symbol,
ID: market.tradableInstrument.instrument.product?.settlementAsset
.id,
}} }}
/> />
), ),