Skip to content

Commit

Permalink
Migrate from jest to vitest (#968)
Browse files Browse the repository at this point in the history
* test: migrate file expanded_story_controls_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_release_date_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_estimate_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_history_location_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_notes_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_owned_by_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_requested_by_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_section_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_state_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_task_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_title_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_tooltip_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_type_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_spec.jsx from enzyme to react-testing-library

* test: user proper I18n mocking in expanded_story_default_spec.js

* test: migrate file expanded_story_labels_spec.jsx from enzyme to react-testing-library

* chore: remove unused TODO comment

* chore: remove screen.debug()

* refactor: optmize the use of context variables in expanded_story_notes_spec.js

* chore: remove console.log() in expanded_story_spec.js

* chore: swap test titles to avoid confusion in expanded_story_state_spec.js

* test: migrate file note_spec.js from enzyme to react-testing-library

* test: migrate file notes_list_spec.js from enzyme to react-testing-library

* test: migrate file select_user_spec.js from enzyme to react-testing-library

* test: migrate file task_list_spec.js from enzyme to react-testing-library

* test: migrate file task_spec.js from enzyme to react-testing-library

* test: migrate file story_description_icon_spec.js from enzyme to react-testing-library

* test: migrate file story_description_spec.js from enzyme to react-testing-library

* test: migrate file story_icon_spec.js from enzyme to react-testing-library

* test: migrate file story_item_spec.js from enzyme to react-testing-library

* test: migrate file story_popover_spec.js from enzyme to react-testing-library

* test: migrate file story_tasks_spec.js from enzyme to react-testing-library

* test: migrate file task_spec.js from jest to vitest

* test: migrate file story_spec.js from jest to vitest

* test: migrate file note_spec.js from jest to vitest

* test: migrate file iteration_spec.js from jest to vitest

* test: migrate file project_spec.js from jest to vitest

* test: migrate file project_spec.js describe 'changesets' it 'should load changesets when last_changset_id is changed' from sinon.fakeServer to msw

* test: migrate describe 'changesets' it 'should only reload a story once if present in multiple changesets' from sinon.fakeServer to msw

* test: migrate project_spec.js from sinon.fakeServer to msw describe 'changesets' it 'should load new stories from changesets'

* test: migrate project_velocity_view_spec.js from jest to vitest

* test: migrate markdown_spec.js from jest to vitest and enyzme to react-testing-library

* test: migrate story_view_spec.js from jest to vitest

* test: fix unhandled request file story_view_spec.js

* test: adjust vitest syntax file column_view_spec.js

* refactor: remove warning adding ref droppable react-beatiful-dnd component

* refactor: remove warning passing prop index for droppable react-beatiful-dnd component

* refactor: remove unecessary key prop component

* refactor: remove debug addition file story_item_spec.js

* chore: change childProps StoryItem component to drill 'releasedDate' attribute for the children as string as type declared

* refactor: add props for not logging warning and reduce rendering job on file sprint_spec.js

* refactor: add correct changes props for HistoryItem component on file history_item_spec.js

* refacor: add props labels on redux initial state for removing unecessary logs file search_spec.js

* refactor: add labels on redux initial state and isDropDisabled props for Sprints component on file sprints_spec.js

* refactor: add onSave and disabled props for component ExpandedStoryTask on file expanded_story_task_spec.js

* refactor: change ExpandedStoryHistoryLocation prop showHistory as optional since it does not have to use showHistory everytime it renders

* refactor: add id attribute on notes for ExpandedStoryNotes component on file expanded_story_notes_spec.js for not logging warnings

* refactor: remove unecessary props on tests file expanded_story_state_spec.js to not log warnings

* refactor: add project.id redux state to supply StorySearch component with correct data

* chore: add msw a fake server request handling for put http method to not log warnings on the console

* fix: rebase conflcits

* Revert "fix: rebase conflcits"

This reverts commit 58fbdfd.

* feat: start set up vitest and remove jest

* chore: readd jest packages and add vitest setupFiles and environment

* refactor: replace jest functions to vi, remove unused import modules setup test file

* refactor: remove unused packages

* test: replace sinon to vitest functionalities

* test: replace jest-sinon to vi functionallities project_spec.js and iteration_spec.js files

* test: replace jest-sinon to vitest functionalities on the file iteration_spec.js

* test: replace sinon to vitest functionalities on the file story_collection_spec.js

* test: replace sinon to vitest functionalities on the file task_spec.js

* test: replace sinon to vitest functionalities on the file story_spec.js

* test: replace sinon to vitest functionalities on the file projectBoard_spec.js

* test: replace sinon to vitest functionalities on the file pastIterations_spec.js

* test: replace sinon to vitest functionalities on the file notifications_spec.js

* test: replace sinon to vitest functionalities on the file note_spec.js

* test: replace sinon to vitest functionalities on the file history_spec.js

* test: fix JSX syntax issue on test files adding PrecompileEjs plugin on the vite.base.config.ts

* test: replace sinon methods to vitest and start applying msw server to replace sinon.fakeServer functionality

* fix: http status handlers msw

* fix: view async action, add a promise to wait for result before continue

* fix: view tests on the file story_view_spec.js

* test: finish replace all sinon functions to vitest

* test: start POC replacing enzyme functionallity to react-testing-library

* test: finish POC replacing enzyme to react-testing-library

* test: fix msw requests

* test: remove last sinon functionality implementation model story_spec.js

* test: replace .tick to .advanceTimersByTime using vitest fn notifications_spec.js action

* test: remove unexpected variable value attribuition

* test: adjust test assertion - always call callback.onToggle

* test: adjust test assertion - calls callback.onToggle

* test: update assertion to callback.onToggle not haveBeenCalled

* test: update test date, it was set up year 2018. Fixed adding current date returning 7 days ago

* test: remove .only from test file

* test: adjust time to be dinamic to the current date

* test: adjust object comparasion on the if statement

* test: migrate file column_item_spec.js from enzyme to react-testing-library

* test: migrated from enzyme to react-testing-library on column_spec.js

* test: fix test trouble when some component return undefined value, declared '|| null' statement to columns_spec.js and remove unnecessary mock

* test: migrate file checkbox_spec.js from enzyme to react-testing-library

* test: migrate file note_form_spec.js from enzyme to react-testing-library

* test: migrate file message_spec.js from enzyme to react-testing-library

* test: migrate file notifications_spec.js from enzyme to react-testing-library

* test: migrate file side_bar_button_info_spec.js from enzyme to react-testing-library

* test: migrate file side_bar_button_spec.js from enzyme to react-testing-library

* test: migrate file side_bar_spec.js from enzyme to react-testing-library

* test: add redux setup for testing

* test: start replacement enzyme to react-testing-library project_board_spec.js

* test: fix 'does not renders <ProjectLoading />' adding parameter chillyBinStories to the component

* test: migrate file project_board_spec.js test 'renders <Sidebar />' from enzyme to react-testing-library

* test: migrate file project_board_spec.js test 'renders <Notifications />' from enzyme to react-testing-library

* test: migrate file project_board_spec.js test 'renders <Columns />' from enzyme to react-testing-library

* test: migrate file project_board_spec.js describe 'when history status is LOADING' from enzyme to react-testing-library

* test: migrate file project_board_spec.js describe 'when history status is LOADED' from enzyme to react-testing-library

* test: migrate file project_board_spec.js describe 'when history status is DISABLED' from enzyme to react-testing-library

* test: migrate file project_board_spec.js describe 'when there are epicStories' and 'when epicStories is empty' from enzyme to react-testing-library

* refactor: english adjustment

* test: migrate file project_card_spec.js describe 'should contain the project name' and '.icons' from enzyme to react-testing-library

* test: migrate file project_card_spec.js describe '#panelHeading' from enzyme to react-testing-library

* test: migrate file project_card_spec.js describe 'joined' from enzyme to react-testing-library

* test: migrate file project_card_spec.js describe 'unjoined' from enzyme to react-testing-library

* test: adjust 'does not have the dag' replacing the tag_name value to null

* test: migrate file project_list_spec.js describe 'with projects' from enzyme to react-testing-library

* test: fix usage waitFor react-testing-library file side_bar_button_spec.js

* refactor: remove unnecessary waitFor import where it's unused

* refactor: remove unnecessary waitFor file project_card_spec.js

* test: finish migrate file project_list_spec.js from enzyme to react-testing-library

* test: migrate file project_search_spec.js from enzyme to react-testing-library

* test: start migrate file search_results_spec.js from enzyme to react-testing-library

* test: wrap <SearchResults/> component with <DragDropContext /> to fix provider trouble

* test: modify setupRedux to be able receiving initial values state store

* test: add initial values redux store

* test: migrate file collapsed_story_actions_spec.js from enzyme to react-testing-library

* test: migrate file collapsed_story_estimate_button_spec.js from enzyme to react-testing-library

* test: migrate file collapsed_story_estimate_spec.js from enzyme to react-testing-library

* test: migrate file collapsed_story_focus_button_spec.js from enzyme to react-testing-library

* test: migrate file collapsed_story_labels_spec.js from enzyme to react-testing-library

* test: migrate file collapsed_story_spec.js from enzyme to react-testing-library

* test: migrate file collapsed_story_state_button_spec.js from enzyme to react-testing-library

* test: migrate file collapsed_story_title_spec.js from enzyme to react-testing-library

* test: pass props down to the inner components in collapsed_story_actions_spec.js and remove mocked children

* test: pass props down to the inner components in collapsed_story_spec.js and remove mocked children

* test: remove unnecessary mock in collapsed_story_state_button_spec.js

* test: use correct test titles in collapsed_story_actions_spec.js

* test: test the correct selector when state is accepted in collapsed_story_actions_spec.js

* test: migrate file search_results_spec.js from enzyme to react-testing-library

* test: migrate file search_spec.js describe 'when have not stories' from enzyme to react-testing-library

* test: migrate file search_spec.js describe 'when have stories' from enzyme to react-testing-library

* test: migrate file search_tooltip_spec.js from enzyme to react-testing-library

* test: migrate file story_search_spec.js from enzyme to react-testing-library

* test: migrate file task_form_spec.js from enzyme to react-testing-library

* test: migrate file task_spec.js from enzyme to react-testing-library

* test: migrate file history_change_spec.js from enzyme to react-testing-library

* test: migrate file history_header_spec.js from enzyme to react-testing-library

* test: migrate file history_item_spec.js from enzyme to react-testing-library

* test: migrate file history_spec.js from enzyme to react-testing-library

* test: migrate file sprint_header_spec.js from enzyme to react-testing-library

* test: migrate file sprint_spec.js from enzyme to react-testing-library

* test: migrate file sprints_spec.js from enzyme to react-testing-library

* test: migrate file story_link_spec.js from enzyme to react-testing-library

* test: use renderWithProviders in collapsed_story_actions_spec.js

* test: use renderWithProviders in collapsed_story_spec.js

* test: migrate file expanded_story_default_spec.js from enzyme to react-testing-library

* test: migrate file expanded_expanded_story_description_content_area_spec.js from enzyme to react-testing-library

* test: migrate file expanded_expanded_story_description_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_controls_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_release_date_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_estimate_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_history_location_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_notes_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_owned_by_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_requested_by_spec.js from enzyme to react-testing-library

* test: migrate file expanded_story_section_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_state_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_task_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_title_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_tooltip_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_type_spec.jsx from enzyme to react-testing-library

* test: migrate file expanded_story_spec.jsx from enzyme to react-testing-library

* test: user proper I18n mocking in expanded_story_default_spec.js

* test: migrate file expanded_story_labels_spec.jsx from enzyme to react-testing-library

* chore: remove unused TODO comment

* chore: remove screen.debug()

* refactor: optmize the use of context variables in expanded_story_notes_spec.js

* chore: remove console.log() in expanded_story_spec.js

* chore: swap test titles to avoid confusion in expanded_story_state_spec.js

* test: migrate file note_spec.js from enzyme to react-testing-library

* test: migrate file notes_list_spec.js from enzyme to react-testing-library

* test: migrate file select_user_spec.js from enzyme to react-testing-library

* test: migrate file task_list_spec.js from enzyme to react-testing-library

* test: migrate file task_spec.js from enzyme to react-testing-library

* test: migrate file story_description_icon_spec.js from enzyme to react-testing-library

* test: migrate file story_description_spec.js from enzyme to react-testing-library

* test: migrate file story_icon_spec.js from enzyme to react-testing-library

* test: migrate file story_item_spec.js from enzyme to react-testing-library

* test: migrate file story_popover_spec.js from enzyme to react-testing-library

* test: migrate file story_tasks_spec.js from enzyme to react-testing-library

* test: migrate file task_spec.js from jest to vitest

* test: migrate file story_spec.js from jest to vitest

* test: migrate file note_spec.js from jest to vitest

* test: migrate file iteration_spec.js from jest to vitest

* test: migrate file project_spec.js from jest to vitest

* test: migrate file project_spec.js describe 'changesets' it 'should load changesets when last_changset_id is changed' from sinon.fakeServer to msw

* test: migrate describe 'changesets' it 'should only reload a story once if present in multiple changesets' from sinon.fakeServer to msw

* test: migrate project_spec.js from sinon.fakeServer to msw describe 'changesets' it 'should load new stories from changesets'

* test: migrate project_velocity_view_spec.js from jest to vitest

* test: migrate markdown_spec.js from jest to vitest and enyzme to react-testing-library

* test: migrate story_view_spec.js from jest to vitest

* test: fix unhandled request file story_view_spec.js

* test: adjust vitest syntax file column_view_spec.js

* refactor: remove warning adding ref droppable react-beatiful-dnd component

* refactor: remove warning passing prop index for droppable react-beatiful-dnd component

* refactor: remove unecessary key prop component

* refactor: remove debug addition file story_item_spec.js

* chore: change childProps StoryItem component to drill 'releasedDate' attribute for the children as string as type declared

* refactor: add props for not logging warning and reduce rendering job on file sprint_spec.js

* refactor: add correct changes props for HistoryItem component on file history_item_spec.js

* refacor: add props labels on redux initial state for removing unecessary logs file search_spec.js

* refactor: add labels on redux initial state and isDropDisabled props for Sprints component on file sprints_spec.js

* refactor: add onSave and disabled props for component ExpandedStoryTask on file expanded_story_task_spec.js

* refactor: change ExpandedStoryHistoryLocation prop showHistory as optional since it does not have to use showHistory everytime it renders

* refactor: add id attribute on notes for ExpandedStoryNotes component on file expanded_story_notes_spec.js for not logging warnings

* refactor: remove unecessary props on tests file expanded_story_state_spec.js to not log warnings

* refactor: add project.id redux state to supply StorySearch component with correct data

* chore: add msw a fake server request handling for put http method to not log warnings on the console

* fix: rebase conflcits

* Revert "fix: rebase conflcits"

This reverts commit 58fbdfd.

* build: remove enzyme enzyme-adapter-react-16 and sinon from dependencies and replace last sinon.fakeServer for msw

* test: follow mike request - replace data-testid ColumnItem.jsx and its tests to querySelector by classes

* test: follow mike request - replace data-testid='message-close-button' but kept data-testid='message-container' on file Message.jsx

* test: follow mike request - replace data-testid='add-note-button' for querySelector by classes on file NoteForm.jsx

* test: follow mike request - replace data-testid for querySelector by classes on files SideBarButtonInfo.jsx and SideBarButton.jsx

* test: follow mike request - replace data-testid for querySelector by classes on file ProjectBoard.jsx

* test: follow mike request - replace data-testid='project-card-tag' for querySelector by classes on file ProjectCard.jsx

* test: follow mike request - replace data-testid='dropdown-menu-container' for querySelector by classes on file ProjeCard.jsx

* test: follow mike request - replace data-testid='user-avatar' for querySelector by classes on file ProjeCard.jsx

* test: follow mike request - replace data-testid for querySelector by classes on file Search.jsx

* test: follow mike request - replace data-testid for querySelector by classes on file StoryPopover.jsx

* refactor: remove unused imported function on file notifications_spec.js

* refactor: remove unused imported function on file project_board_spec.js

* test: follow mike request - replace all byTestId for querySelector by class on project_board_spec.js file

* refactor: remove unused imported component on file project_list_spec.js

* refactor: remove unused imported component and functions on file project_search_spec.js

* refactor: remove unused imported component and functions on file task_spec.js

* refactor: remove unused imported function on file task_form_spec.js

* test: follow mike request - replace data-testid for querySelector by class on story_search_spec.js file

* refactor: remove unused debug function file story_search_spec.js

* refactor: remove unecessary spread props History/index.jsx file

* refactor: remove unecessary spread props files Notifications/index.jsx and Sidebar/index.jsx

---------

Co-authored-by: Mike Valeriano <[email protected]>
Co-authored-by: William Spada <[email protected]>
  • Loading branch information
3 people committed Sep 30, 2024
1 parent 7a82260 commit 1944599
Show file tree
Hide file tree
Showing 119 changed files with 6,106 additions and 6,623 deletions.
5 changes: 3 additions & 2 deletions app/assets/javascripts/components/Columns/ColumnItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const DroppableColumn = ({
canClose,
columnId,
}) =>
visible && (
(visible && (
<Droppable
droppableId={JSON.stringify({ columnId })}
isDropDisabled={isDone(columnId)}
Expand All @@ -65,7 +65,8 @@ const DroppableColumn = ({
/>
)}
</Droppable>
);
)) ||
null;

Column.propTypes = {
title: PropTypes.string.isRequired,
Expand Down
5 changes: 4 additions & 1 deletion app/assets/javascripts/components/Notifications/Message.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ const Message = ({ type, className, message, onRemove }) => {
const modifierClassName = type ? `Message--${type}` : '';

return (
<div className={`Message ${modifierClassName} ${className}`}>
<div
className={`Message ${modifierClassName} ${className}`}
data-testid="message-container"
>
<div className="Message__content">
{message}
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export default class Popover extends Component {
render() {
return (
<Fragment>
{this.props.children({ ref: this.saveChildRef })}
<div data-testid="story-popover-children">
{this.props.children({ ref: this.saveChildRef })}
</div>
<div style={{ display: 'none' }}>
{this.props.renderContent({ ref: this.saveContentRef })}
</div>
Expand Down
4 changes: 0 additions & 4 deletions app/assets/javascripts/components/projects/ProjectBoard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ export const ProjectBoard = ({
const unsubscribe = subscribeToProjectChanges(project, () => {
fetchProjectBoard(projectId);
});

return () => {
unsubscribe();
};
}, [projectId, fetchProjectBoard]);

if (!projectBoard.isFetched && projectBoard.isInitialLoading) {
Expand Down
3 changes: 3 additions & 0 deletions app/assets/javascripts/components/projects/ProjectCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default class ProjectCard extends React.Component {
data-toggle="tooltip"
data-placement="top"
data-title={I18n.t('reports')}
data-testid="report-icon-anchor"
>
<i className="mi md-20 heading-icon">insert_chart</i>
</a>
Expand All @@ -59,6 +60,7 @@ export default class ProjectCard extends React.Component {
className="unstyled-link"
data-toggle="tooltip"
data-placement="top"
data-testid="user-icon-anchor"
>
<i className="mi md-20 heading-icon">group</i>
</a>
Expand All @@ -70,6 +72,7 @@ export default class ProjectCard extends React.Component {
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
data-testid="settings-icon-anchor"
>
<i className="mi md-20 heading-icon">settings</i>
</a>
Expand Down
9 changes: 7 additions & 2 deletions app/assets/javascripts/components/projects/ProjectList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ export default class ProjectList extends React.Component {
<Fragment>
<div className="col-md-12 project-list-title">
<h4>
<i className="mi md-20 heading-icon">view_module</i> {title} |{' '}
{projects.length}
<i
className="mi md-20 heading-icon"
data-testid="view-module-title"
>
view_module
</i>{' '}
{title} | {projects.length}
</h4>
</div>
{this.cards()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default class ProjectSearch extends React.Component {
<select
id="project_type"
className="unstyled-input"
data-testid="select-project-filter"
onChange={this.handleSearch}
ref="projectsFilter"
>
Expand Down
6 changes: 5 additions & 1 deletion app/assets/javascripts/components/search/SearchTooltip.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React from 'react';

const SearchTooltip = ({ aditionalClass = '' }) => (
<div className={`col-sm-12 ${aditionalClass}`} data-id="search-tooltip">
<div
className={`col-sm-12 ${aditionalClass}`}
data-id="search-tooltip"
data-testid="search-tooltip-component"
>
<div className="tooltip-header">
<h4>{I18n.t('projects.search_tooltip.title')}</h4>
<ul>
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/components/stories/Stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const Stories = ({ stories, from, sprintIndex, columnId, isDropDisabled }) => (
className="Column__body"
ref={provided.innerRef}
{...provided.droppableProps}
data-testid="stories-container"
>
{stories.map((story, index) => (
<StoryItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const ExpandedStoryHistoryLocation = ({ story, onClone, showHistory }) => (
ExpandedStoryHistoryLocation.propTypes = {
story: editingStoryPropTypesShape.isRequired,
onClone: PropTypes.func.isRequired,
showHistory: PropTypes.func.isRequired,
showHistory: PropTypes.func,
};

export default ExpandedStoryHistoryLocation;
5 changes: 4 additions & 1 deletion app/assets/javascripts/components/story/StoryItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export const StoryItem = ({
};

const childProps = {
story,
story: {
...story,
releaseDate: story.releaseDate?.toString() || '',
},
onToggle: () => toggleStory(story.id, from),
className,
title,
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/components/story/note/Note.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import NotePropTypes from '../../shapes/note';

const Note = ({ note, onDelete, disabled }) => (
<div className="markdown-wrapper">
<div className="markdown-wrapper" data-testid="note-component">
<Markdown source={note.note} />

<div className="markdown-wrapper__text-right">
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ const store = createStore(
composeWithDevTools(applyMiddleware(thunk.withExtraArgument(dependencies)))
);

export const testStore = preloadedState => {
return createStore(reducer, preloadedState);
};

export default store;
37 changes: 24 additions & 13 deletions app/assets/javascripts/views/story_view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const StoryView = FormView.extend({
this.model[transitionEvent]({ silent: true });

var that = this;
this.model.save(null, {
return this.model.save(null, {
success: function (model, response) {
that.saveInProgress = false;
that.render();
Expand All @@ -223,7 +223,7 @@ const StoryView = FormView.extend({
this.model.set({ estimate: points });

var that = this;
this.model.save(null, {
return this.model.save(null, {
success: function (model, response) {
that.saveInProgress = false;
that.render();
Expand Down Expand Up @@ -322,7 +322,7 @@ const StoryView = FormView.extend({

var that = this;

this.model.save(null, {
return this.model.save(null, {
success: function (model, response) {
that.enableForm();
that.model.set({ editing: editMode });
Expand Down Expand Up @@ -542,21 +542,24 @@ const StoryView = FormView.extend({
);
},

appendAttachments: function() {
appendAttachments: function () {
this.$el.append(
this.makeFormControl(function(div) {
this.makeFormControl(function (div) {
const $storyAttachments = $('<div class="story-attachments"></div>');
$(div).append($storyAttachments);

if(process.env.NODE_ENV !== 'test') {
if (process.env.NODE_ENV !== 'test') {
clearTimeout(window.executeAttachinaryTimeout);
window.executeAttachinaryTimeout = setTimeout(ExecuteAttachinary, 1000);
window.executeAttachinaryTimeout = setTimeout(
ExecuteAttachinary,
1000
);
}
})
);
},

renderCollapsed: function(isGuest) {
renderCollapsed: function (isGuest) {
this.$el.removeClass('editing');
this.$el.html(this.template({ story: this.model, view: this }));
this.$el.toggleClass(
Expand All @@ -575,14 +578,22 @@ const StoryView = FormView.extend({
const estimateButtons = this.$('[data-story-estimate-buttons]').get(0);
if (estimateButtons) {
ReactDOM.render(
<StoryEstimateButtons points={this.model.point_values()} onClick={this.estimate} />,
<StoryEstimateButtons
points={this.model.point_values()}
onClick={this.estimate}
/>,
estimateButtons
);
}

const copyStoryIdClipboardLink = this.$('[data-story-id-copy-clipboard]').get(0)
if(copyStoryIdClipboardLink) {
ReactDOM.render(<StoryCopyIdClipboard id={this.id} />, copyStoryIdClipboardLink)
const copyStoryIdClipboardLink = this.$(
'[data-story-id-copy-clipboard]'
).get(0);
if (copyStoryIdClipboardLink) {
ReactDOM.render(
<StoryCopyIdClipboard id={this.id} />,
copyStoryIdClipboardLink
);
}

if (isGuest) {
Expand Down Expand Up @@ -1160,7 +1171,7 @@ const StoryView = FormView.extend({
},

clickSave: function (event) {
this.saveEdit(event, false);
return this.saveEdit(event, false);
},

toggleControlButtons: function (isDisabled, changeCancel) {
Expand Down
45 changes: 6 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,14 @@
"version": "0.0.1",
"license": "MIT",
"scripts": {
"test": "jest",
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
"test": "vitest",
"coveralls": "vitest run --coverage --coverageReporters=text-lcov | coveralls",
"lint": "eslint app/assets/javascripts",
"start:test": "rails s -e test -p 5000 & wait-on http://localhost:5000",
"cy:run": "cypress run -P spec/",
"format": "prettier --write 'app/assets/javascripts/**/*.{js,jsx}'",
"prepare": "husky install"
},
"jest": {
"setupFilesAfterEnv": [
"jest-sinon",
"./node_modules/jest-enzyme/lib/index.js",
"<rootDir>/spec/javascripts/support/setup.js"
],
"testMatch": [
"<rootDir>/spec/javascripts/**/*_spec.js"
],
"transform": {
"^.+\\.ejs$": "<rootDir>/spec/javascripts/support/ejsTransformer.js",
"^.+\\.jsx?$": "babel-jest"
},
"moduleNameMapper": {
"^vendor/(.*)": "<rootDir>/vendor/assets/javascripts/$1",
"^collections/(.*)": "<rootDir>/app/assets/javascripts/collections/$1",
"^mixins/(.*)": "<rootDir>/app/assets/javascripts/mixins/$1",
"^models/(.*)": "<rootDir>/app/assets/javascripts/models/$1",
"^templates/(.*)": "<rootDir>/app/assets/javascripts/templates/$1",
"^views/(.*)": "<rootDir>/app/assets/javascripts/views/$1",
"^libs/(.*)": "<rootDir>/app/assets/javascripts/libs/$1",
"^components/(.*)": "<rootDir>/app/assets/javascripts/components/$1",
"^controllers/(.*)": "<rootDir>/app/assets/javascripts/controllers/$1",
"^reducers/(.*)": "<rootDir>/app/assets/javascripts/reducers/$1",
"^actions/(.*)": "<rootDir>/app/assets/javascripts/actions/$1",
"^central/(.*)": "<rootDir>/app/assets/javascripts/central/$1",
"^store/(.*)": "<rootDir>/app/assets/javascripts/store/$1",
"^gritter$": "gritter/js/jquery.gritter.min.js"
}
},
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.4",
Expand Down Expand Up @@ -117,8 +87,6 @@
"babel-jest": "^24.9.0",
"coveralls": "^3.0.9",
"cypress": "^10.1.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-react-app": "^5.0.2",
Expand All @@ -129,16 +97,15 @@
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.16.0",
"husky": "^8.0.0",
"jest": "^26.6.3",
"jest-enzyme": "^7.1.2",
"jest-sinon": "^1.0.1",
"jsdom": "^25.0.0",
"lint-staged": "^15.0.2",
"msw": "^2.4.4",
"prettier": "^3.0.3",
"react-addons-test-utils": "^15.6.2",
"react-test-renderer": "^16.12.0",
"sinon": "^7.5.0",
"vite": "^4.5.3",
"vite-plugin-ruby": "^3.2.0"
"vite-plugin-ruby": "^3.2.0",
"vitest": "^2.0.5"
},
"engines": {
"node": "18.12.0"
Expand Down
Loading

0 comments on commit 1944599

Please sign in to comment.