Skip to content

Commit

Permalink
More test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
fadwamahmoud committed Nov 7, 2023
1 parent 2658797 commit aedf8d6
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 197 deletions.
119 changes: 0 additions & 119 deletions packages/client/src/store/selectors/__testData__/slots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,6 @@ const prevoiusWeek = {
},
};

/**
* This is the week prior to `currentWeek` (2021-08-23 - 2021-08-29) and should alway get filtered out.
*/
const prevoiusWeekDateIds = {
"2021-08-23": {
["2021-08-23-9"]: {
...baseSlot,
categories: [Category.Competitive],
id: "slot-0",
type: SlotType.Ice,
},
},
"2021-08-24": {
["2021-08-23-9"]: {
...baseSlot,
categories: [Category.PreCompetitiveAdults],
id: "slot-1",
type: SlotType.OffIce,
},
},
"2021-08-25-9": {
["slot-2"]: {
...baseSlot,
categories: [Category.CourseMinors],
id: "slot-2",
type: SlotType.OffIce,
},
},
};

/**
* Start of `currentWeek` (2021-08-30 - 2021-09-05) belonging to the `prevMonth` (2021-08)
*/
Expand All @@ -95,22 +65,7 @@ export const currentWeekPrevMonth = {
},
};

export const currentWeekPrevMonthDateId = {
"2021-08-31": {
["2021-08-31-9"]: {
...baseSlot,
id: "slot-3",
categories: [Category.Competitive, Category.CourseMinors],
type: SlotType.Ice,
},
},
};

const fullPrevoiusMonth = { ...prevoiusWeek, ...currentWeekPrevMonth };
const fullPrevoiusMonthDateIds = {
...prevoiusWeekDateIds,
...currentWeekPrevMonthDateId,
};
// #region previousMonth

// #region currentMonth
Expand Down Expand Up @@ -141,24 +96,6 @@ const currentWeekThisMonthCompetitive = {
},
},
};
const currentWeekThisMonthCompetitiveDateIds = {
"2021-09-01": {
["2021-09-01-9"]: {
...baseSlot,
id: "slot-4",
categories: [Category.Competitive, Category.PreCompetitiveMinors],
type: SlotType.Ice,
},
},
"2021-09-03": {
["2021-09-01-9"]: {
...baseSlot,
id: "slot-5",
categories: [Category.Competitive],
type: SlotType.OffIce,
},
},
};
/**
* Slots belonging to `currentMonth` part of `currentWeek`.
* Should be displayed for admin, but filtered out for customer as they're not of
Expand Down Expand Up @@ -219,24 +156,6 @@ const nextWeekCompetitive = {
},
},
};
const nextWeekCompetitiveDateIds = {
"2021-09-06": {
["2021-09-06-9"]: {
...baseSlot,
id: "slot-8",
categories: [Category.Competitive, Category.PreCompetitiveMinors],
type: SlotType.Ice,
},
},
"2021-09-07": {
["2021-09-06-9"]: {
...baseSlot,
id: "slot-9",
categories: [Category.Competitive],
type: SlotType.OffIce,
},
},
};
/**
* Slots of `nextWeek` (2021-09-06 - 2021-09-12) belonging not belonging to `Category.Competitive`.
* Should get filtered out in tests anyhow.
Expand All @@ -259,24 +178,6 @@ const nextWeekNonCompetitive = {
},
},
};
const nextWeekNonCompetitiveDateIds = {
"2021-09-06": {
["slot-10"]: {
...baseSlot,
id: "slot-10",
categories: [Category.PreCompetitiveAdults],
type: SlotType.Ice,
},
},
"2021-09-07": {
["slot-11"]: {
...baseSlot,
id: "slot-11",
categories: [Category.PreCompetitiveAdults],
type: SlotType.OffIce,
},
},
};
/**
* Second week of `currentMonth` including both `Category.Competitive` slots and different category.
*/
Expand All @@ -290,16 +191,6 @@ const fullNextWeek = Object.keys(nextWeekCompetitive).reduce(
}),
{} as SlotsByDay
);
const fullNextWeekDateIds = Object.keys(nextWeekCompetitive).reduce(
(acc, isoDate) => ({
...acc,
[isoDate]: {
...nextWeekCompetitiveDateIds[isoDate],
...nextWeekNonCompetitiveDateIds[isoDate],
},
}),
{} as SlotsByDay
);
/**
* Current month slots with `Category.Competitive`
*/
Expand All @@ -311,10 +202,6 @@ const currentMonthCompetitive = {
* Full current month for test store
*/
const fullCurrentMonth = { ...currentWeekThisMonth, ...fullNextWeek };
const fullCurrentMonthDateId = {
...currentWeekThisMonthCompetitiveDateIds,
...fullNextWeekDateIds,
};
// #endregion currentMonth

// #region testData
Expand Down Expand Up @@ -365,10 +252,4 @@ export const slotsByDay: NonNullable<
["2021-08"]: fullPrevoiusMonth,
["2021-09"]: fullCurrentMonth,
};
export const slotsByDayDateIds: NonNullable<
LocalStore["firestore"]["data"]["slotsByDay"]
> = {
["2021-08"]: fullPrevoiusMonthDateIds,
["2021-09"]: fullCurrentMonthDateId,
};
// #endregion testData
Loading

0 comments on commit aedf8d6

Please sign in to comment.