Skip to content

Commit

Permalink
test: follow mike request - replace all byTestId for querySelector by…
Browse files Browse the repository at this point in the history
… class on project_board_spec.js file
  • Loading branch information
wrspada02 committed Sep 30, 2024
1 parent 1b08e94 commit 330d7ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
8 changes: 1 addition & 7 deletions app/assets/javascripts/components/projects/ProjectBoard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ export const ProjectBoard = ({

<SideBar
data-id="side-bar"
data-testid="sidebar-component"
reverse={projectBoard.reverse}
visibleColumns={projectBoard.visibleColumns}
toggleColumn={toggleColumn}
Expand All @@ -179,7 +178,6 @@ export const ProjectBoard = ({
notifications={notifications}
onRemove={removeNotification}
data-id="notifications"
data-testid="notifications-component"
/>

<Columns
Expand Down Expand Up @@ -209,11 +207,7 @@ export const ProjectBoard = ({
canClose
>
{history.status === historyStatus.LOADED ? (
<History
history={history.activities}
data-id="history"
data-testid="history-component"
/>
<History history={history.activities} data-id="history" />
) : (
<ProjectLoading data-id="project-loading" />
)}
Expand Down
24 changes: 12 additions & 12 deletions spec/javascripts/components/projects/project_board_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('<ProjectBoard />', () => {
});

it('renders <SideBar />', () => {
const { getByTestId } = renderComponent({
const { container } = renderComponent({
projectBoard: {
isFetched: true,
search: {
Expand All @@ -126,11 +126,11 @@ describe('<ProjectBoard />', () => {
},
});

expect(getByTestId('sidebar-component')).toBeInTheDocument();
expect(container.querySelector('.SideBar')).toBeInTheDocument();
});

it('render <Notifications />', () => {
const { getByTestId } = renderComponent({
const { container } = renderComponent({
projectBoard: {
isFetched: true,
search: {
Expand All @@ -145,7 +145,7 @@ describe('<ProjectBoard />', () => {
},
});

expect(getByTestId('notifications-component')).toBeInTheDocument();
expect(container.querySelector('.Notifications')).toBeInTheDocument();
});

it('render <Columns />', () => {
Expand Down Expand Up @@ -198,9 +198,9 @@ describe('<ProjectBoard />', () => {
});

it('does not render history', () => {
const { queryByTestId } = renderComponent(props);
const { container } = renderComponent(props);

expect(queryByTestId('history-component')).not.toBeInTheDocument();
expect(container.querySelector('.History')).not.toBeInTheDocument();
});

it('renders loading', () => {
Expand Down Expand Up @@ -242,9 +242,9 @@ describe('<ProjectBoard />', () => {
});

it('renders history', () => {
const { getByTestId } = renderComponent(props);
const { container } = renderComponent(props);

expect(getByTestId('history-component')).toBeInTheDocument();
expect(container.querySelector('.History')).toBeInTheDocument();
});

it('does not render loading', () => {
Expand Down Expand Up @@ -286,9 +286,9 @@ describe('<ProjectBoard />', () => {
});

it('does not render history', () => {
const { queryByTestId } = renderComponent(props);
const { container } = renderComponent(props);

expect(queryByTestId('history-component')).not.toBeInTheDocument();
expect(container.querySelector('.History')).not.toBeInTheDocument();
});

it('does not render loading', () => {
Expand Down Expand Up @@ -330,9 +330,9 @@ describe('<ProjectBoard />', () => {
});

it('does not render history', () => {
const { queryByTestId } = renderComponent(props);
const { container } = renderComponent(props);

expect(queryByTestId('history-component')).not.toBeInTheDocument();
expect(container.querySelector('.History')).not.toBeInTheDocument();
});

it('renders loading', () => {
Expand Down

0 comments on commit 330d7ba

Please sign in to comment.