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.
Merge pull request #80 from CudoVentures/CUDOS-2076-Implement-missing…
…-TxMsg-parsing CUDOS-2076 missing Msgs - Address book module
- Loading branch information
Showing
77 changed files
with
2,629 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { AddressBookDetailsValue } from '@src/models/msg/types'; | ||
import StyledTypographyPair from '../styled_typography_pair'; | ||
|
||
const AddressBookDetails = ({ content }: { content: AddressBookDetailsValue }) => { | ||
return ( | ||
<> | ||
{content.network ? <StyledTypographyPair text="Network:" content={content.network} /> : null} | ||
{content.label ? <StyledTypographyPair text="Label:" content={content.label} /> : null} | ||
{content.value ? <StyledTypographyPair text="Value:" content={content.value} /> : null} | ||
</> | ||
); | ||
}; | ||
|
||
export default AddressBookDetails; |
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,5 @@ | ||
export const addressBookDetails = { | ||
gap: '10px', | ||
width: '100%', | ||
display: 'flex', | ||
}; |
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
9 changes: 9 additions & 0 deletions
9
src/components/msg/addressbook/create_address/__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,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`screen: TransactionDetails/MsgCreateAddress matches snapshot 1`] = ` | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
message_contents:txCreateAddress | ||
</p> | ||
`; |
45 changes: 45 additions & 0 deletions
45
src/components/msg/addressbook/create_address/index.test.tsx
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,45 @@ | ||
import React from 'react'; | ||
import { RecoilRoot } from 'recoil'; | ||
import renderer from 'react-test-renderer'; | ||
import { MockTheme } from '@tests/utils'; | ||
import { MsgCreateAddress } from '@models'; | ||
import CreateAddress from '.'; | ||
|
||
// ================================== | ||
// mocks | ||
// ================================== | ||
|
||
jest.mock('@components', () => ({ | ||
Name: (props) => <div id="Name" {...props} />, | ||
})); | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('screen: TransactionDetails/MsgCreateAddress', () => { | ||
it('matches snapshot', () => { | ||
const message = new MsgCreateAddress({ | ||
category: 'addressbook', | ||
type: 'MsgCreateAddress', | ||
creator: 'creatorAddress', | ||
network: 'testNetwork', | ||
label: 'testLabel', | ||
value: 'testValue', | ||
}); | ||
const component = renderer.create( | ||
<RecoilRoot> | ||
<MockTheme> | ||
<CreateAddress | ||
message={message} | ||
/> | ||
</MockTheme> | ||
</RecoilRoot>, | ||
); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
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,42 @@ | ||
import React from 'react'; | ||
import Trans from 'next-translate/Trans'; | ||
import { Typography } from '@material-ui/core'; | ||
import { | ||
Name, | ||
AddressBookDetails, | ||
} from '@components'; | ||
import { MsgCreateAddress } from '@models'; | ||
|
||
const CreateAddress = (props: { | ||
message: MsgCreateAddress; | ||
}) => { | ||
const { message } = props; | ||
const { creator } = message; | ||
|
||
return ( | ||
<Typography> | ||
<Trans | ||
i18nKey="message_contents:txCreateAddress" | ||
components={[ | ||
( | ||
<Name | ||
address={creator} | ||
name={creator} | ||
/> | ||
), | ||
( | ||
<AddressBookDetails | ||
content={{ | ||
network: message.network, | ||
label: message.label, | ||
value: message.value, | ||
}} | ||
/> | ||
), | ||
]} | ||
/> | ||
</Typography> | ||
); | ||
}; | ||
|
||
export default CreateAddress; |
9 changes: 9 additions & 0 deletions
9
src/components/msg/addressbook/delete_address/__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,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`screen: TransactionDetails/MsgDeleteAddress matches snapshot 1`] = ` | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
message_contents:txDeleteAddress | ||
</p> | ||
`; |
45 changes: 45 additions & 0 deletions
45
src/components/msg/addressbook/delete_address/index.test.tsx
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,45 @@ | ||
import React from 'react'; | ||
import { RecoilRoot } from 'recoil'; | ||
import renderer from 'react-test-renderer'; | ||
import { MockTheme } from '@tests/utils'; | ||
import { MsgDeleteAddress } from '@models'; | ||
import CreateAddress from '.'; | ||
|
||
// ================================== | ||
// mocks | ||
// ================================== | ||
|
||
jest.mock('@components', () => ({ | ||
Name: (props) => <div id="Name" {...props} />, | ||
})); | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('screen: TransactionDetails/MsgDeleteAddress', () => { | ||
it('matches snapshot', () => { | ||
const message = new MsgDeleteAddress({ | ||
category: 'addressbook', | ||
type: 'MsgDeleteAddress', | ||
creator: 'creatorAddress', | ||
network: 'testNetwork', | ||
label: 'testLabel', | ||
value: 'testValue', | ||
}); | ||
const component = renderer.create( | ||
<RecoilRoot> | ||
<MockTheme> | ||
<CreateAddress | ||
message={message} | ||
/> | ||
</MockTheme> | ||
</RecoilRoot>, | ||
); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
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,42 @@ | ||
import React from 'react'; | ||
import Trans from 'next-translate/Trans'; | ||
import { Typography } from '@material-ui/core'; | ||
import { | ||
Name, | ||
AddressBookDetails, | ||
} from '@components'; | ||
import { MsgDeleteAddress } from '@models'; | ||
|
||
const DeleteAddress = (props: { | ||
message: MsgDeleteAddress; | ||
}) => { | ||
const { message } = props; | ||
const { creator } = message; | ||
|
||
return ( | ||
<Typography> | ||
<Trans | ||
i18nKey="message_contents:txDeleteAddress" | ||
components={[ | ||
( | ||
<Name | ||
address={creator} | ||
name={creator} | ||
/> | ||
), | ||
( | ||
<AddressBookDetails | ||
content={{ | ||
network: message.network, | ||
label: message.label, | ||
value: message.value, | ||
}} | ||
/> | ||
), | ||
]} | ||
/> | ||
</Typography> | ||
); | ||
}; | ||
|
||
export default DeleteAddress; |
9 changes: 9 additions & 0 deletions
9
src/components/msg/addressbook/update_address/__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,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`screen: TransactionDetails/MsgUpdateAddress matches snapshot 1`] = ` | ||
<p | ||
className="MuiTypography-root MuiTypography-body1" | ||
> | ||
message_contents:txUpdateAddress | ||
</p> | ||
`; |
45 changes: 45 additions & 0 deletions
45
src/components/msg/addressbook/update_address/index.test.tsx
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,45 @@ | ||
import React from 'react'; | ||
import { RecoilRoot } from 'recoil'; | ||
import renderer from 'react-test-renderer'; | ||
import { MockTheme } from '@tests/utils'; | ||
import { MsgUpdateAddress } from '@models'; | ||
import CreateAddress from '.'; | ||
|
||
// ================================== | ||
// mocks | ||
// ================================== | ||
|
||
jest.mock('@components', () => ({ | ||
Name: (props) => <div id="Name" {...props} />, | ||
})); | ||
|
||
// ================================== | ||
// unit tests | ||
// ================================== | ||
describe('screen: TransactionDetails/MsgUpdateAddress', () => { | ||
it('matches snapshot', () => { | ||
const message = new MsgUpdateAddress({ | ||
category: 'addressbook', | ||
type: 'MsgUpdateAddress', | ||
creator: 'creatorAddress', | ||
network: 'testNetwork', | ||
label: 'testLabel', | ||
value: 'testValue', | ||
}); | ||
const component = renderer.create( | ||
<RecoilRoot> | ||
<MockTheme> | ||
<CreateAddress | ||
message={message} | ||
/> | ||
</MockTheme> | ||
</RecoilRoot>, | ||
); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
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,42 @@ | ||
import React from 'react'; | ||
import Trans from 'next-translate/Trans'; | ||
import { Typography } from '@material-ui/core'; | ||
import { | ||
Name, | ||
AddressBookDetails, | ||
} from '@components'; | ||
import { MsgUpdateAddress } from '@models'; | ||
|
||
const UpdateAddress = (props: { | ||
message: MsgUpdateAddress; | ||
}) => { | ||
const { message } = props; | ||
const { creator } = message; | ||
|
||
return ( | ||
<Typography> | ||
<Trans | ||
i18nKey="message_contents:txUpdateAddress" | ||
components={[ | ||
( | ||
<Name | ||
address={creator} | ||
name={creator} | ||
/> | ||
), | ||
( | ||
<AddressBookDetails | ||
content={{ | ||
network: message.network, | ||
label: message.label, | ||
value: message.value, | ||
}} | ||
/> | ||
), | ||
]} | ||
/> | ||
</Typography> | ||
); | ||
}; | ||
|
||
export default UpdateAddress; |
Oops, something went wrong.