Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme-NL committed Oct 25, 2023
1 parent a0e491a commit a28e5fc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
20 changes: 13 additions & 7 deletions spec/javascripts/models/beta/iteration_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1325,8 +1325,11 @@ describe("iteration", function () {

expect(normalizedPastIterations).toEqual({
pastIterations: {
1: { iterationNumber: 1, data: "Iteration 1" },
2: { iterationNumber: 2, data: "Iteration 2" },
byId: {
1: { iterationNumber: 1, data: "Iteration 1" },
2: { iterationNumber: 2, data: "Iteration 2" },
},
allIds: [1, 2],
},
});
});
Expand All @@ -1335,23 +1338,26 @@ describe("iteration", function () {
it("denormalize an object of pastIterations into an array", () => {
const normalizedPastIterations = {
pastIterations: {
1: { iterationNumber: 1, data: "Iteration 1 data" },
2: { iterationNumber: 2, data: "Iteration 2 data" },
byId: {
1: { iterationNumber: 1, data: "Iteration 1" },
2: { iterationNumber: 2, data: "Iteration 2" },
},
allIds: [1, 2],
},
};
const denormalizedPastIterations = denormalizePastIterations(
normalizedPastIterations
);

expect(denormalizedPastIterations).toEqual([
{ iterationNumber: 1, data: "Iteration 1 data" },
{ iterationNumber: 2, data: "Iteration 2 data" },
{ iterationNumber: 1, data: "Iteration 1" },
{ iterationNumber: 2, data: "Iteration 2" },
]);
});

it("handle an empty object", () => {
const normalizedPastIterations = {
pastIterations: {},
pastIterations: { byId: {}, allIds: [] },
};
const denormalizedPastIterations = denormalizePastIterations(
normalizedPastIterations
Expand Down
17 changes: 10 additions & 7 deletions spec/javascripts/selectors/columns_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,20 @@ describe("Columns Selector", () => {
describe("DONE", () => {
const pastIterations = {
pastIterations: {
420: {
iterationNumber: 420,
startDate: previousSprintDate.format("YYYY/MM/DD"),
endDate: currentSprintDate.format("YYYY/MM/DD"),
storyIds: [42],
byId: {
420: {
iterationNumber: 420,
startDate: previousSprintDate.format("YYYY/MM/DD"),
endDate: currentSprintDate.format("YYYY/MM/DD"),
storyIds: [42],
},
},
allIds: [420],
},
};
it("return pastIterations with start and end date", () => {
const startDate = pastIterations.pastIterations[420].startDate;
const endDate = pastIterations.pastIterations[420].endDate;
const startDate = pastIterations.pastIterations.byId[420].startDate;
const endDate = pastIterations.pastIterations.byId[420].endDate;
const doneSprints = getColumns({
column: Column.DONE,
pastIterations,
Expand Down

0 comments on commit a28e5fc

Please sign in to comment.