Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/pages/people/tabs/__tests__/Wanted.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ describe('Wanted Component', () => {

test('should redirect to bounty page when bounty card is clicked', async () => {
const mockPush = jest.fn();
const openSpy = jest.spyOn(window, 'open').mockImplementation(jest.fn());

jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
Expand Down Expand Up @@ -282,9 +283,12 @@ describe('Wanted Component', () => {
getAllByTestId('user-created-bounty')[0].click();
expect(getAllByTestId('user-created-bounty').length).toBe(1);
expect(getAllByTestId('user-created-bounty')[0].getAttribute('href')).toEqual(
`/p/1234/wanted/${userBounty.body.id}/0`
`/bounty/${userBounty.body.id}`
);
expect(openSpy).toHaveBeenCalledWith(`/bounty/${userBounty.body.id}`, '_blank');
});

openSpy.mockRestore();
});

test('should render status assigned if ticket is assigned', async () => {
Expand Down
24 changes: 24 additions & 0 deletions src/people/widgetViews/__tests__/UserTicketsView.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,30 @@ describe('UserTickets', () => {
});
});

it('links assigned bounty cards to the new bounty URL', async () => {
const userBounty = { ...mockBounties[0], body: {} } as any;
userBounty.body = {
...mockBounties[0].bounty,
owner_id: person.owner_pubkey,
title: 'test bounty here'
} as any;
jest
.spyOn(mainStore, 'getPersonAssignedBounties')
.mockReturnValue(Promise.resolve([userBounty]));

await act(async () => {
const { getByTestId } = render(
<MemoryRouter initialEntries={['/p/1234/assigned']}>
<Route path="/p/:uuid/assigned" component={UserTickets} />
</MemoryRouter>
);

const bountyCard = await waitFor(() => getByTestId('user-personal-bounty-card'));

expect(bountyCard).toHaveAttribute('href', `/bounty/${userBounty.body.id}`);
});
});

it('renders price matching the bounty', async () => {
const userBounty = { ...mockBounties[0], body: {} } as any;
userBounty.body = {
Expand Down