From 3071081e205c852c4f8e8e13d57086ea2cffafe4 Mon Sep 17 00:00:00 2001
From: "Felix C. Morency" <1102868+fmorency@users.noreply.github.com>
Date: Thu, 7 Nov 2024 14:22:17 -0500
Subject: [PATCH] fix: proposal confirmation form test
---
.../groups/forms/proposals/ConfirmationForm.tsx | 5 -----
.../proposals/__tests__/ConfirmationForm.test.tsx | 15 ++++++---------
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/components/groups/forms/proposals/ConfirmationForm.tsx b/components/groups/forms/proposals/ConfirmationForm.tsx
index 2c78927d..70ff9197 100644
--- a/components/groups/forms/proposals/ConfirmationForm.tsx
+++ b/components/groups/forms/proposals/ConfirmationForm.tsx
@@ -127,9 +127,7 @@ export default function ConfirmationForm({
if (messageData.amount && !Array.isArray(messageData.amount)) {
messageData.amount = [messageData.amount];
}
- console.log({ messageData });
const composedMessage = composer(messageData as MessageTypeMap[typeof message.type]);
- console.log({ composedMessage });
if (!composedMessage || !composedMessage.value) {
console.error('Composed message or its value is undefined:', composedMessage);
throw new Error(`Failed to compose message for type: ${message.type}`);
@@ -183,8 +181,6 @@ export default function ConfirmationForm({
const CID = await uploadMetaDataToIPFS();
const messages: Any[] = formData.messages.map(message => getMessageObject(message));
- console.log(formData.messages);
- console.log({ messages });
const msg = cosmos.group.v1.MessageComposer.fromPartial.submitProposal({
groupPolicyAddress: policyAddress,
messages: messages,
@@ -194,7 +190,6 @@ export default function ConfirmationForm({
summary: formData.metadata.summary,
exec: 0,
});
- console.log({ msg });
const fee = await estimateFee(address ?? '', [msg]);
await tx([msg], {
fee,
diff --git a/components/groups/forms/proposals/__tests__/ConfirmationForm.test.tsx b/components/groups/forms/proposals/__tests__/ConfirmationForm.test.tsx
index 900a2eb8..6244910f 100644
--- a/components/groups/forms/proposals/__tests__/ConfirmationForm.test.tsx
+++ b/components/groups/forms/proposals/__tests__/ConfirmationForm.test.tsx
@@ -43,17 +43,14 @@ describe('ConfirmationModal Component', () => {
test('renders component with correct details', () => {
renderWithChainProvider();
- expect(screen.getByText('Confirmation')).toBeInTheDocument();
- expect(screen.getByLabelText('proposal-details')).toBeInTheDocument();
expect(screen.getByText(mockProposalFormData.title)).toBeInTheDocument();
expect(screen.getByText('manifest1hj5fv...8ws9ct')).toBeInTheDocument();
- // TODO: This is never displayed in the component
- // expect(screen.getByText(mockFormData.summary)).toBeInTheDocument();
-
- expect(screen.getByText('MESSAGES')).toBeInTheDocument();
- expect(screen.getByText('METADATA')).toBeInTheDocument();
- expect(screen.getByLabelText('meta-details')).toBeInTheDocument();
+ expect(screen.getByText('Messages')).toBeInTheDocument();
+ expect(screen.getByText('Type')).toBeInTheDocument();
+ expect(screen.getByText('send')).toBeInTheDocument();
+ expect(screen.getByText('Metadata')).toBeInTheDocument();
+ expect(screen.getByText(mockProposalFormData.metadata.authors)).toBeInTheDocument();
expect(screen.getByText(mockProposalFormData.metadata.title)).toBeInTheDocument();
expect(screen.getByText(mockProposalFormData.metadata.summary)).toBeInTheDocument();
expect(screen.getByText(mockProposalFormData.metadata.details)).toBeInTheDocument();
@@ -61,7 +58,7 @@ describe('ConfirmationModal Component', () => {
test('calls prevStep when "Prev: Metadata" button is clicked', () => {
renderWithChainProvider();
- const prevButton = screen.getByText('Prev: Metadata');
+ const prevButton = screen.getByText('Back: Metadata');
fireEvent.click(prevButton);
expect(mockProps.prevStep).toHaveBeenCalled();
});