From bfccae4c4c62eba47245e3418564497c7af8a43b Mon Sep 17 00:00:00 2001 From: Jeewhan Date: Fri, 20 Sep 2024 15:43:35 +0900 Subject: [PATCH] =?UTF-8?q?minor:=20dinnerPreferredDateTime=20=EC=9D=B4=20?= =?UTF-8?q?=EB=B9=88=20=EB=AC=B8=EC=9E=90=EC=97=B4=EC=9D=BC=20=EB=95=8C=20?= =?UTF-8?q?dinnerPreferredDateTimeList=20=EA=B0=80=20['']=20=EA=B0=80=20?= =?UTF-8?q?=EC=95=84=EB=8B=8C=20[]=EA=B0=80=20=EB=90=98=EB=8F=84=EB=A1=9D?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/club-member.spec.ts | 9 +++++++-- src/models/club-member.ts | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/models/club-member.spec.ts b/src/models/club-member.spec.ts index 3cc552c..505624a 100644 --- a/src/models/club-member.spec.ts +++ b/src/models/club-member.spec.ts @@ -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", () => { diff --git a/src/models/club-member.ts b/src/models/club-member.ts index 195e971..6b02e00 100644 --- a/src/models/club-member.ts +++ b/src/models/club-member.ts @@ -15,6 +15,10 @@ export default class ClubMember { ) {} get dinnerPreferredDateTimeList(): string[] { + if (!this.dinnerPreferredDateTime.trim()) { + return []; + } + return this.dinnerPreferredDateTime.split(", "); }