Skip to content

Commit

Permalink
[QA] #87 - QA용 stub데이터 추가 및 home QA on/off버튼 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
meltsplit committed Nov 2, 2024
1 parent c7ce785 commit f25dbb8
Show file tree
Hide file tree
Showing 6 changed files with 311 additions and 39 deletions.
48 changes: 42 additions & 6 deletions SantaManito-iOS/SantaManito-iOS/Data/Entity/Room/Member.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ struct Member: Hashable {

extension [Member] {

static var stub1: [Member] {
static var stub_notStarted_4members: [Member] {
return [
Member(santa: .stub1, manitto: nil),
Member(santa: .stub2, manitto: nil),
Member(santa: .stub3, manitto: nil),

Member(santa: .stub4, manitto: nil),
]
}

static var stub2: [Member] {
static var stub_matched_4members: [Member] {
return [
Member(santa: .stub1, manitto: .stub2),
Member(santa: .stub2, manitto: .stub3),
Expand All @@ -32,11 +32,47 @@ extension [Member] {
]
}

static var stub3: [Member] {
static var stub_notStarted_17members: [Member] {
return [
Member(santa: .stub1, manitto: nil),
Member(santa: .stub2, manitto: nil),
Member(santa: .stub3, manitto: nil),
Member(santa: .stub4, manitto: nil),
Member(santa: .stub5, manitto: nil),
Member(santa: .stub6, manitto: nil),
Member(santa: .stub7, manitto: nil),
Member(santa: .stub8, manitto: nil),
Member(santa: .stub9, manitto: nil),
Member(santa: .stub10, manitto: nil),
Member(santa: .stub11, manitto: nil),
Member(santa: .stub12, manitto: nil),
Member(santa: .stub13, manitto: nil),
Member(santa: .stub14, manitto: nil),
Member(santa: .stub15, manitto: nil),
Member(santa: .stub16, manitto: nil),
Member(santa: .stub17, manitto: nil)
]
}

static var stub_matched_17members: [Member] {
return [
Member(santa: .stub1, manitto: .stub2),
Member(santa: .stub2, manitto: .stub1)
Member(santa: .stub2, manitto: .stub3),
Member(santa: .stub3, manitto: .stub4),
Member(santa: .stub4, manitto: .stub5),
Member(santa: .stub5, manitto: .stub6),
Member(santa: .stub6, manitto: .stub7),
Member(santa: .stub7, manitto: .stub8),
Member(santa: .stub8, manitto: .stub9),
Member(santa: .stub9, manitto: .stub10),
Member(santa: .stub10, manitto: .stub11),
Member(santa: .stub11, manitto: .stub12),
Member(santa: .stub12, manitto: .stub13),
Member(santa: .stub13, manitto: .stub14),
Member(santa: .stub14, manitto: .stub15),
Member(santa: .stub15, manitto: .stub16),
Member(santa: .stub16, manitto: .stub17),
Member(santa: .stub17, manitto: .stub1)
]
}

}
104 changes: 93 additions & 11 deletions SantaManito-iOS/SantaManito-iOS/Data/Entity/Room/Mission.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,73 @@ public struct Mission: Identifiable, Hashable, Decodable {

extension Mission {
static var stub1: Mission {
// .init(content: "손 잡기", id: UUID())
.init(content: "손 잡기", id: "1")
.init(content: "손 잡기 1", id: "mission_id_1")
}

static var stub2: Mission {
// .init(content: "손 잡기", id: UUID())
.init(content: "손 잡기", id: "2")
.init(content: "손 잡기 2", id: "mission_id_2")
}

static var stub3: Mission {
// .init(content: "손 잡기", id: UUID())
.init(content: "손 잡기", id: "3")
.init(content: "손 잡기 3", id: "mission_id_3")
}

static var stub4: Mission {
// .init(content: "손 잡기", id: UUID())
.init(content: "손 잡기", id: "4")
.init(content: "손 잡기 4", id: "mission_id_4")
}

static var stub5: Mission {
.init(content: "손 잡기 5", id: "mission_id_5")
}

static var stub6: Mission {
.init(content: "손 잡기 6", id: "mission_id_6")
}

static var stub7: Mission {
.init(content: "손 잡기 7", id: "mission_id_7")
}

static var stub8: Mission {
.init(content: "손 잡기 8", id: "mission_id_8")
}

static var stub9: Mission {
.init(content: "손 잡기 9", id: "mission_id_9")
}

static var stub10: Mission {
.init(content: "손 잡기 10", id: "mission_id_10")
}

static var stub11: Mission {
.init(content: "손 잡기 11", id: "mission_id_11")
}

static var stub12: Mission {
.init(content: "손 잡기 12", id: "mission_id_12")
}

static var stub13: Mission {
.init(content: "손 잡기 13", id: "mission_id_13")
}

static var stub14: Mission {
.init(content: "손 잡기 14", id: "mission_id_14")
}

static var stub15: Mission {
.init(content: "손 잡기 15", id: "mission_id_15")
}

static var stub16: Mission {
.init(content: "손 잡기 16", id: "mission_id_16")
}

static var stub17: Mission {
.init(content: "손 잡기 17", id: "mission_id_17")
}


static func dummy() -> [Mission] {
return [
Expand All @@ -50,3 +99,36 @@ extension Mission {
]
}
}

extension [Mission] {
static var stub_4mission: Self {
[
.init(content: "손 잡기 1", id: "mission_id_1"),
.init(content: "손 잡기 2", id: "mission_id_2"),
.init(content: "손 잡기 3", id: "mission_id_3"),
.init(content: "손 잡기 4", id: "mission_id_4"),
]
}

static var stub_17mission: Self {
[
.init(content: "손 잡기 1", id: "mission_id_1"),
.init(content: "손 잡기 2", id: "mission_id_2"),
.init(content: "손 잡기 3", id: "mission_id_3"),
.init(content: "손 잡기 4", id: "mission_id_4"),
.init(content: "손 잡기 5", id: "mission_id_5"),
.init(content: "손 잡기 6", id: "mission_id_6"),
.init(content: "손 잡기 7", id: "mission_id_7"),
.init(content: "손 잡기 8", id: "mission_id_8"),
.init(content: "손 잡기 9", id: "mission_id_9"),
.init(content: "손 잡기 10", id: "mission_id_10"),
.init(content: "손 잡기 11", id: "mission_id_11"),
.init(content: "손 잡기 12", id: "mission_id_12"),
.init(content: "손 잡기 13", id: "mission_id_13"),
.init(content: "손 잡기 14", id: "mission_id_14"),
.init(content: "손 잡기 15", id: "mission_id_15"),
.init(content: "손 잡기 16", id: "mission_id_16"),
.init(content: "손 잡기 17", id: "mission_id_17")
]
}
}
41 changes: 36 additions & 5 deletions SantaManito-iOS/SantaManito-iOS/Data/Entity/Room/RoomDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ extension RoomDetail {
state: .notStarted,
creatorID: User.stub1.id,
creatorName: User.stub1.username,
members: .stub1,
members: .stub_notStarted_4members,
mission: [
.stub1,
.stub2,
Expand All @@ -117,7 +117,7 @@ extension RoomDetail {
state: .inProgress,
creatorID: User.stub1.id,
creatorName: User.stub1.username,
members: .stub2,
members: .stub_matched_4members,
mission: [.stub1,
.stub2,
.stub3,
Expand All @@ -135,7 +135,7 @@ extension RoomDetail {
state: .expired,
creatorID: User.stub2.id,
creatorName: User.stub2.username,
members: .stub2,
members: .stub_notStarted_4members,
mission: [.stub1,
.stub2,
.stub3,
Expand All @@ -153,7 +153,7 @@ extension RoomDetail {
state: .completed,
creatorID: User.stub1.id,
creatorName: User.stub1.username,
members: .stub3,
members: .stub_matched_17members,
mission: [.stub1,
.stub2,
.stub3,
Expand All @@ -171,7 +171,7 @@ extension RoomDetail {
state: .deleted,
creatorID: User.stub1.id,
creatorName: User.stub1.username,
members: .stub3,
members: .stub_notStarted_17members,
mission: [.stub1,
.stub2,
.stub3,
Expand All @@ -181,3 +181,34 @@ extension RoomDetail {
)
}
}

extension [RoomDetail] {
static var stub: Self {
var result: Self = []
for (state, expirationDate) in zip(
[RoomState.completed, .deleted, .expired, .inProgress, .notStarted],
[Date().addingTimeInterval(-24 * 60 * 60), Date().addingTimeInterval(-24 * 60 * 60), Date().addingTimeInterval(-24 * 60 * 60), Date().addingTimeInterval(24 * 60 * 60), Date().addingTimeInterval(24 * 60 * 60)]
)
{
for name in ["네글자요", "일이삼사오육칠팔구십", "일이삼사오육칠팔구십일이삼사오육칠"] {
for creator in [User.stub1, User.stub2] {
if state == .notStarted {
for members in [[Member].stub_notStarted_4members, .stub_notStarted_17members] {
let roomDetail = RoomDetail(id: UUID().uuidString, name: name, invitationCode: "초대코드", state: state, creatorID: creator.id, creatorName: creator.username, members: members, mission: [], createdAt: Date().addingTimeInterval(-24 * 60 * 60), expirationDate: expirationDate)

result.append(roomDetail)
}
} else {
for (members, missions) in zip([[Member].stub_matched_4members, .stub_matched_17members], [[Mission].stub_4mission, .stub_17mission]) {
let roomDetail = RoomDetail(id: UUID().uuidString, name: name, invitationCode: "초대코드", state: state, creatorID: creator.id, creatorName: creator.username, members: members, mission: missions, createdAt: Date().addingTimeInterval(-24 * 60 * 60), expirationDate: expirationDate)

result.append(roomDetail)
}
}

}
}
}
return result.sorted()
}
}
Loading

0 comments on commit f25dbb8

Please sign in to comment.