Skip to content

Commit

Permalink
fix: remove opt in logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinBuyck committed Nov 19, 2024
1 parent 7284e97 commit 9d71f03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions api/src/utilities/lottery-date-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ export class LotteryDateParamValidator implements ValidatorConstraintInterface {
listingEvents: ListingEvent[] | undefined,
args: ValidationArguments,
) {
const { reviewOrderType, lotteryOptIn } = args.object as {
const { reviewOrderType } = args.object as {
reviewOrderType: string;
lotteryOptIn: boolean;
};
if (reviewOrderType === ReviewOrderTypeEnum.lottery && lotteryOptIn) {
if (reviewOrderType === ReviewOrderTypeEnum.lottery) {
return !!listingEvents.find(
(event: ListingEvent) =>
event.type === ListingEventsTypeEnum.publicLottery &&
Expand Down
4 changes: 2 additions & 2 deletions api/test/unit/utilities/lottery-date-validator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Testing OrderQueryParamValidator', () => {
).toBeTruthy();
});

it('should return true if reviewOrderType is lottery and lotteryOptIn is no', () => {
it('should return false if reviewOrderType is lottery and lotteryOptIn is no', () => {
const lotteryDateParamValidator = new LotteryDateParamValidator();
expect(
lotteryDateParamValidator.validate([], {
Expand All @@ -31,7 +31,7 @@ describe('Testing OrderQueryParamValidator', () => {
constraints: [],
targetName: '',
}),
).toBeTruthy();
).toBeFalsy();
});

it('should return false if reviewOrderType is lottery and lotteryOptIn is yes and listingEvents is empty', () => {
Expand Down

0 comments on commit 9d71f03

Please sign in to comment.