forked from forbole/big-dipper-2.0-cosmos
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CUDOS-2076 missing Msgs - Marketplace
- Loading branch information
1 parent
935dafd
commit f76bd30
Showing
60 changed files
with
2,166 additions
and
39 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
24 changes: 24 additions & 0 deletions
24
src/components/msg/marketplace/add_admin/__snapshots__/index.test.tsx.snap
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,24 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`screen: TransactionDetails/MsgAddAdmin matches snapshot 1`] = ` | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
<div | ||
components={ | ||
Array [ | ||
<Name | ||
address="creator" | ||
name="creator" | ||
/>, | ||
<Name | ||
address="address" | ||
name="address" | ||
/>, | ||
] | ||
} | ||
i18nKey="message_contents:txAddAdmin" | ||
id="message_contents:txAddAdmin" | ||
/> | ||
</p> | ||
`; |
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,44 @@ | ||
import React from 'react'; | ||
import { RecoilRoot } from 'recoil'; | ||
import renderer from 'react-test-renderer'; | ||
import { MockTheme } from '@tests/utils'; | ||
import { MsgAddAdmin } from '@models'; | ||
import AddAdmin from '.'; | ||
|
||
jest.mock('@components', () => ({ | ||
Name: (props) => <div id="Name" {...props} />, | ||
})); | ||
|
||
jest.mock('next-translate/Trans', () => ( | ||
(props) => <div id={props.i18nKey} {...props} /> | ||
)); | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('screen: TransactionDetails/MsgAddAdmin', () => { | ||
it('matches snapshot', () => { | ||
const message = new MsgAddAdmin({ | ||
category: 'marketplace', | ||
type: 'MsgAddAdmin', | ||
creator: 'creator', | ||
address: 'address', | ||
}); | ||
const component = renderer.create( | ||
<RecoilRoot> | ||
<MockTheme> | ||
<AddAdmin | ||
message={message} | ||
/> | ||
</MockTheme> | ||
</RecoilRoot>, | ||
); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
expect(component.root.findByProps({ id: 'message_contents:txAddAdmin' }).props.i18nKey).toEqual('message_contents:txAddAdmin'); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
}); |
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,40 @@ | ||
import React from 'react'; | ||
import Trans from 'next-translate/Trans'; | ||
import { Typography } from '@material-ui/core'; | ||
import { | ||
Name, | ||
} from '@components'; | ||
import { MsgAddAdmin } from '@models'; | ||
|
||
const AddAdmin = (props: { | ||
message: MsgAddAdmin; | ||
}) => { | ||
const { message } = props; | ||
const { | ||
creator, address, | ||
} = message; | ||
|
||
return ( | ||
<Typography> | ||
<Trans | ||
i18nKey="message_contents:txAddAdmin" | ||
components={[ | ||
( | ||
<Name | ||
address={creator} | ||
name={creator} | ||
/> | ||
), | ||
( | ||
<Name | ||
address={address} | ||
name={address} | ||
/> | ||
), | ||
]} | ||
/> | ||
</Typography> | ||
); | ||
}; | ||
|
||
export default AddAdmin; |
30 changes: 30 additions & 0 deletions
30
src/components/msg/marketplace/buy_nft/__snapshots__/index.test.tsx.snap
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,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`screen: TransactionDetails/MsgBuyNft matches snapshot 1`] = ` | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
<div | ||
components={ | ||
Array [ | ||
<Name | ||
address="buyer" | ||
name="buyer" | ||
/>, | ||
<Name | ||
address="seller" | ||
name="seller" | ||
/>, | ||
] | ||
} | ||
i18nKey="message_contents:txBuyNft" | ||
id="message_contents:txBuyNft" | ||
values={ | ||
Object { | ||
"id": undefined, | ||
"price": "1 acudos", | ||
} | ||
} | ||
/> | ||
</p> | ||
`; |
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,48 @@ | ||
import React from 'react'; | ||
import { RecoilRoot } from 'recoil'; | ||
import renderer from 'react-test-renderer'; | ||
import { MockTheme } from '@tests/utils'; | ||
import { MsgBuyNft } from '@models'; | ||
import { formatToken } from '@src/utils/format_token'; | ||
import BuyNft from '.'; | ||
|
||
jest.mock('@components', () => ({ | ||
Name: (props) => <div id="Name" {...props} />, | ||
})); | ||
|
||
jest.mock('next-translate/Trans', () => ( | ||
(props) => <div id={props.i18nKey} {...props} /> | ||
)); | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('screen: TransactionDetails/MsgBuyNft', () => { | ||
it('matches snapshot', () => { | ||
const message = new MsgBuyNft({ | ||
category: 'marketplace', | ||
type: 'MsgBuyNft', | ||
seller: 'seller', | ||
buyer: 'buyer', | ||
id: 'id', | ||
price: formatToken('1', 'acudos'), | ||
}); | ||
|
||
const component = renderer.create( | ||
<RecoilRoot> | ||
<MockTheme> | ||
<BuyNft | ||
message={message} | ||
/> | ||
</MockTheme> | ||
</RecoilRoot>, | ||
); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
expect(component.root.findByProps({ id: 'message_contents:txBuyNft' }).props.i18nKey).toEqual('message_contents:txBuyNft'); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
}); |
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,39 @@ | ||
import React from 'react'; | ||
import Trans from 'next-translate/Trans'; | ||
import { Typography } from '@material-ui/core'; | ||
import { Name } from '@components'; | ||
import { MsgBuyNft } from '@models'; | ||
|
||
const BuyNft = (props: { | ||
message: MsgBuyNft; | ||
}) => { | ||
const { message } = props; | ||
|
||
return ( | ||
<Typography> | ||
<Trans | ||
i18nKey="message_contents:txBuyNft" | ||
components={[ | ||
( | ||
<Name | ||
address={message.buyer} | ||
name={message.buyer} | ||
/> | ||
), | ||
( | ||
<Name | ||
address={message.seller} | ||
name={message.seller} | ||
/> | ||
), | ||
]} | ||
values={{ | ||
price: `${message.price.value} ${message.price.displayDenom}`, | ||
id: message.id, | ||
}} | ||
/> | ||
</Typography> | ||
); | ||
}; | ||
|
||
export default BuyNft; |
Oops, something went wrong.