Skip to content

Commit

Permalink
minor: dinnerPreferredDateTime 이 빈 문자열일 때 dinnerPreferredDateTimeList…
Browse files Browse the repository at this point in the history
… 가 [''] 가 아닌 []가 되도록 수정
  • Loading branch information
Jeewhan committed Sep 20, 2024
1 parent 81ea3e9 commit bfccae4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/models/club-member.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ describe("ClubMember", () => {

test("get dinnerPreferredDateTimeList", () => {
// given
const member = generateMockClubMemberBy("lunch-dinner");
const a = generateMockClubMemberBy("lunch-dinner");
const b = generateMockClubMemberBy("lunch-dinner");

// when
b.dinnerPreferredDateTime = "";

// then
expect(member.dinnerPreferredDateTimeList).toBeInstanceOf(Array);
expect(a.dinnerPreferredDateTimeList).toBeInstanceOf(Array);
expect(b.dinnerPreferredDateTimeList).toEqual([]);
});

test("isEligibleForLunch", () => {
Expand Down
4 changes: 4 additions & 0 deletions src/models/club-member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export default class ClubMember {
) {}

get dinnerPreferredDateTimeList(): string[] {
if (!this.dinnerPreferredDateTime.trim()) {
return [];
}

return this.dinnerPreferredDateTime.split(", ");
}

Expand Down

0 comments on commit bfccae4

Please sign in to comment.