Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
samwel141 committed Aug 6, 2024
2 parents 09ff63b + b268a05 commit 4bbebf9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 26 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# [2.1.0-v2.11](https://github.com/Greenstand/treetracker-wallet-admin-client/compare/v2.1.0-v2.10...v2.1.0-v2.11) (2024-07-30)


### Features

* added trust request types ([a7634a4](https://github.com/Greenstand/treetracker-wallet-admin-client/commit/a7634a4c782cdb6e688e362e0bae7524522bcb93))
* updated test ([e8c44fb](https://github.com/Greenstand/treetracker-wallet-admin-client/commit/e8c44fb404853ddf1b484e5d6b325a56a8116eba))

# [2.1.0-v2.10](https://github.com/Greenstand/treetracker-wallet-admin-client/compare/v2.1.0-v2.9...v2.1.0-v2.10) (2024-06-25)


### Bug Fixes

* fix typos ([0dc1c24](https://github.com/Greenstand/treetracker-wallet-admin-client/commit/0dc1c24be298811047dd55101e2e33f188bc471f))

# [2.1.0-v2.9](https://github.com/Greenstand/treetracker-wallet-admin-client/compare/v2.1.0-v2.8...v2.1.0-v2.9) (2024-05-21)


Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "treetracker-wallet-admin-client",
"version": "2.1.0-v2.9",
"version": "2.1.0-v2.11",
"private": true,
"dependencies": {
"@emotion/react": "^11.10.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ import { requestTrustRelationship } from '../../../api/trust_relationships';
import Message from '../../../components/UI/components/Message/Message';
import { useTrustRelationshipsContext } from '../../../store/TrustRelationshipsContext';

const trustRequestTypeList = [
{
label: 'Send',
value: 'send',
},
{
label: 'Deduct',
value: 'deduct',
},
{
label: 'Manage',
value: 'manage',
},
];

const CreateTrustRelationship = () => {
const [dialogOpen, setDialogOpen] = useState(false);

Expand Down Expand Up @@ -88,7 +73,7 @@ const CreateNewRelationshipDialog = ({ open, handleClose }) => {
const [sendRequestError, setSendRequestError] = useState('');

const authContext = useContext(AuthContext);
const { loadData } = useTrustRelationshipsContext();
const { loadData, requestTypeList } = useTrustRelationshipsContext();

const closeDialog = () => {
setRequestSuccess(false);
Expand Down Expand Up @@ -164,6 +149,7 @@ const CreateNewRelationshipDialog = ({ open, handleClose }) => {
);
console.log(trustRelationshipRequest);
setRequestSuccess(true);
setSendRequestError('');
resetFields();
loadData();
} catch (error) {
Expand Down Expand Up @@ -215,7 +201,7 @@ const CreateNewRelationshipDialog = ({ open, handleClose }) => {
IconComponent={ArrowDropDown}
label={'Trust Request Type'}
>
{trustRequestTypeList.map((type, index) => {
{requestTypeList.map((type, index) => {
return (
<MenuItem key={index} value={type.value}>
{type.label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ describe('Request trust relationship', function () {
screen.getByRole('listbox', { name: /Trust Request Type/ })
).toBeInTheDocument();

expect(screen.getAllByRole('option')).toHaveLength(3);
expect(screen.getAllByRole('option')).toHaveLength(6);
expect(screen.getByRole('option', { name: /Send/ })).toBeInTheDocument();
expect(screen.getByRole('option', { name: /Deduct/ })).toBeInTheDocument();
expect(screen.getByRole('option', { name: /Manage/ })).toBeInTheDocument();

// screen.getByRole('');
expect(screen.getByRole('option', { name: /Release/ })).toBeInTheDocument();
expect(screen.getByRole('option', { name: /Receive/ })).toBeInTheDocument();
expect(screen.getByRole('option', { name: /Yield/ })).toBeInTheDocument();
});

it('close and cancel buttons work correctly', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/store/TrustRelationshipsContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const TrustRelationshipsProvider = ({ children }) => {
}
setCount(local_count);
const preparedRows = prepareRows(await data.trust_relationships);

setTableRows(preparedRows);
setTotalRowCount(data.total);
} catch (error) {
Expand Down

0 comments on commit 4bbebf9

Please sign in to comment.