Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme-NL authored and GabrielRMuller committed Aug 12, 2024
1 parent f7f0153 commit 9ca5cfe
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 79 deletions.
5 changes: 2 additions & 3 deletions app/assets/javascripts/actions/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,8 @@ export const dragDropStory =
const newStory = Story.addNewAttributes(story, newAttributes);

const storiesWithUpdatedPositions = Story.sortOptimistically(
stories,
newStory,
from
storiesWithScope(stories, from),
newStory
);

try {
Expand Down
9 changes: 5 additions & 4 deletions app/assets/javascripts/models/beta/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import StoryPropTypesShape, {
import moment from 'moment';
import { has } from 'underscore';
import * as History from './history';
import { storiesWithScope } from '../../reducers/stories';

const compareValues = (a, b) => {
if (a > b) return 1;
Expand Down Expand Up @@ -140,6 +139,9 @@ export const update = async (story, projectId, options) => {
};

export const getHighestNewPosition = stories => {
if (stories.length === 1) {
return 1;
}
const highestPositionValue = stories
.filter(story => story.newPosition !== null)
.reduce((acc, story) => {
Expand Down Expand Up @@ -481,10 +483,9 @@ export const donePoints = stories =>
export const remainingPoints = stories =>
totalPoints(stories) - donePoints(stories);

export const sortOptimistically = (stories, newStory, from) => {
const scopeStories = storiesWithScope(stories, from);
export const sortOptimistically = (stories, newStory) => {
const isChillyBinStory = isUnscheduled(newStory);
const targetStories = scopeStories.filter(
const targetStories = stories.filter(
story => isUnscheduled(story) === isChillyBinStory
);

Expand Down
Loading

0 comments on commit 9ca5cfe

Please sign in to comment.