Skip to content

Conversation

@kalkv
Copy link
Member

@kalkv kalkv commented Jan 3, 2021

I implemented new tests. I tried to write test whether a element is rendering with correct href attributte value also but I'm afraid that without custom queries it is impossible. Am I wrong?

test.todo('test');
import React from 'react';
import { render, screen } from '@testing-library/react';
// import userEvent from '@testing-library/user-event';
Copy link
Collaborator

@roertbb roertbb Feb 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if unused - can be removed? 😉

@roertbb
Copy link
Collaborator

roertbb commented Feb 25, 2021

I implemented new tests. I tried to write test whether a element is rendering with correct href attributte value also but I'm afraid that without custom queries it is impossible. Am I wrong?

expect(screen.getByRole('link')).toHaveAttribute('href', event.url);

should do the job ;)

import { render, screen } from '@testing-library/react';
// import userEvent from '@testing-library/user-event';
import moment from 'moment';
import 'moment/locale/en-gb';
Copy link
Collaborator

@roertbb roertbb Feb 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need that actually here actually, it would be worth it to do that in setupTests to make it work for all tests

import ListingItem from './listing-item';

const event = {
date: '25.03.2021',
Copy link
Collaborator

@roertbb roertbb Feb 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new Date(2021, 2, 25) would be more suitable to match events coming from events.js

@roertbb
Copy link
Collaborator

roertbb commented Feb 25, 2021

Ping me on priv next time pls , it can increase the probability I'll 👀 such things sooner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants