From c0550a3fdb4ff7e6debc0d81a6ef10d1c1b0c184 Mon Sep 17 00:00:00 2001 From: Arrey-Etta <33989423+okhot@users.noreply.github.com> Date: Thu, 7 Mar 2024 04:26:12 +0100 Subject: [PATCH] changes --- src/pages/people/tabs/Wanted.spec.tsx | 49 +++------------------------ 1 file changed, 5 insertions(+), 44 deletions(-) diff --git a/src/pages/people/tabs/Wanted.spec.tsx b/src/pages/people/tabs/Wanted.spec.tsx index 8a04f2f4..bb55f7b0 100644 --- a/src/pages/people/tabs/Wanted.spec.tsx +++ b/src/pages/people/tabs/Wanted.spec.tsx @@ -583,59 +583,22 @@ describe('Wanted Component', () => { userBounty.body = { ...userBounty.bounty, owner_id: person.owner_pubkey, - title: 'new test', - description: 'this is a new test' + title: 'new text', + description: 'new text' }; - const createdMockBounties = Array.from({ length: 1 }, (_: any, index: number) => ({ - ...(mockBounties[0] || {}), - bounty: { - ...(mockBounties[0]?.bounty || {}), - id: mockBounties[0]?.bounty?.id + index + 1 - } - })); - - const userBounties = createdMockBounties.map((bounty: any, index: number) => ({ - ...bounty, - body: { - ...bounty.bounty, - owner_id: person.owner_pubkey, - title: `This is a test bounty ${index}` - } - })) as any; - (usePerson as jest.Mock).mockImplementation(() => ({ person: {}, canEdit: true })); - (useStores as jest.Mock).mockReturnValue({ - main: { - getPersonCreatedBounties: jest.fn(() => [userBounties]) - }, - ui: { - selectedPerson: '123', - meInfo: { - owner_alias: 'test' - } - } - }); - - jest - .spyOn(mainStore, 'getPersonCreatedBounties') - .mockReturnValue(Promise.resolve(userBounties)); + jest.spyOn(mainStore, 'getOrganizationBounties'); act(async () => { - render( + const { getByText } = render( ); - - await waitFor(() => expect(mainStore.getPersonCreatedBounties()).toHaveBeenCalled()); - - const postBountyButton = screen.getByText('Post a Bounty'); - fireEvent.click(postBountyButton); - const PostBountyButton = await screen.findByRole('button', { name: /Post a Bounty/i }); expect(PostBountyButton).toBeInTheDocument(); fireEvent.click(PostBountyButton); @@ -669,9 +632,7 @@ describe('Wanted Component', () => { const FinishButton = await screen.findByRole('button', { name: /Finish/i }); expect(FinishButton).toBeInTheDocument(); fireEvent.click(FinishButton); - expect(screen.getByText(userBounty.body.title)).toBeInTheDocument(); - - await waitFor(() => expect(screen.queryByText('new test')).toBeInTheDocument()); + expect(getByText(userBounty.body.title)).toBeInTheDocument(); }); }); });