mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Remove the protocol for SpaceServiceRoom given its a struct type. (#5000)
* Remove the protocol for SpaceServiceRoom given its a struct type. * Fix a few missed mocks in the unit tests.
This commit is contained in:
@@ -16721,16 +16721,16 @@ class SpaceRoomListProxyMock: SpaceRoomListProxyProtocol, @unchecked Sendable {
|
||||
set(value) { underlyingId = value }
|
||||
}
|
||||
var underlyingId: String!
|
||||
var spaceServiceRoomPublisher: CurrentValuePublisher<SpaceServiceRoomProtocol, Never> {
|
||||
var spaceServiceRoomPublisher: CurrentValuePublisher<SpaceServiceRoom, Never> {
|
||||
get { return underlyingSpaceServiceRoomPublisher }
|
||||
set(value) { underlyingSpaceServiceRoomPublisher = value }
|
||||
}
|
||||
var underlyingSpaceServiceRoomPublisher: CurrentValuePublisher<SpaceServiceRoomProtocol, Never>!
|
||||
var spaceRoomsPublisher: CurrentValuePublisher<[SpaceServiceRoomProtocol], Never> {
|
||||
var underlyingSpaceServiceRoomPublisher: CurrentValuePublisher<SpaceServiceRoom, Never>!
|
||||
var spaceRoomsPublisher: CurrentValuePublisher<[SpaceServiceRoom], Never> {
|
||||
get { return underlyingSpaceRoomsPublisher }
|
||||
set(value) { underlyingSpaceRoomsPublisher = value }
|
||||
}
|
||||
var underlyingSpaceRoomsPublisher: CurrentValuePublisher<[SpaceServiceRoomProtocol], Never>!
|
||||
var underlyingSpaceRoomsPublisher: CurrentValuePublisher<[SpaceServiceRoom], Never>!
|
||||
var paginationStatePublisher: CurrentValuePublisher<SpaceRoomListPaginationState, Never> {
|
||||
get { return underlyingPaginationStatePublisher }
|
||||
set(value) { underlyingPaginationStatePublisher = value }
|
||||
@@ -16809,11 +16809,11 @@ class SpaceRoomListProxyMock: SpaceRoomListProxyProtocol, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
var topLevelSpacesPublisher: CurrentValuePublisher<[SpaceServiceRoomProtocol], Never> {
|
||||
var topLevelSpacesPublisher: CurrentValuePublisher<[SpaceServiceRoom], Never> {
|
||||
get { return underlyingTopLevelSpacesPublisher }
|
||||
set(value) { underlyingTopLevelSpacesPublisher = value }
|
||||
}
|
||||
var underlyingTopLevelSpacesPublisher: CurrentValuePublisher<[SpaceServiceRoomProtocol], Never>!
|
||||
var underlyingTopLevelSpacesPublisher: CurrentValuePublisher<[SpaceServiceRoom], Never>!
|
||||
var spaceFilterPublisher: CurrentValuePublisher<[SpaceServiceFilter], Never> {
|
||||
get { return underlyingSpaceFilterPublisher }
|
||||
set(value) { underlyingSpaceFilterPublisher = value }
|
||||
@@ -16922,13 +16922,13 @@ class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
var spaceForIdentifierSpaceIDReceivedSpaceID: String?
|
||||
var spaceForIdentifierSpaceIDReceivedInvocations: [String] = []
|
||||
|
||||
var spaceForIdentifierSpaceIDUnderlyingReturnValue: Result<SpaceServiceRoomProtocol?, SpaceServiceProxyError>!
|
||||
var spaceForIdentifierSpaceIDReturnValue: Result<SpaceServiceRoomProtocol?, SpaceServiceProxyError>! {
|
||||
var spaceForIdentifierSpaceIDUnderlyingReturnValue: Result<SpaceServiceRoom?, SpaceServiceProxyError>!
|
||||
var spaceForIdentifierSpaceIDReturnValue: Result<SpaceServiceRoom?, SpaceServiceProxyError>! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return spaceForIdentifierSpaceIDUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Result<SpaceServiceRoomProtocol?, SpaceServiceProxyError>? = nil
|
||||
var returnValue: Result<SpaceServiceRoom?, SpaceServiceProxyError>? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = spaceForIdentifierSpaceIDUnderlyingReturnValue
|
||||
}
|
||||
@@ -16946,9 +16946,9 @@ class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
}
|
||||
var spaceForIdentifierSpaceIDClosure: ((String) async -> Result<SpaceServiceRoomProtocol?, SpaceServiceProxyError>)?
|
||||
var spaceForIdentifierSpaceIDClosure: ((String) async -> Result<SpaceServiceRoom?, SpaceServiceProxyError>)?
|
||||
|
||||
func spaceForIdentifier(spaceID: String) async -> Result<SpaceServiceRoomProtocol?, SpaceServiceProxyError> {
|
||||
func spaceForIdentifier(spaceID: String) async -> Result<SpaceServiceRoom?, SpaceServiceProxyError> {
|
||||
spaceForIdentifierSpaceIDCallsCount += 1
|
||||
spaceForIdentifierSpaceIDReceivedSpaceID = spaceID
|
||||
DispatchQueue.main.async {
|
||||
@@ -17062,13 +17062,13 @@ class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
var joinedParentsChildIDReceivedChildID: String?
|
||||
var joinedParentsChildIDReceivedInvocations: [String] = []
|
||||
|
||||
var joinedParentsChildIDUnderlyingReturnValue: Result<[SpaceServiceRoomProtocol], SpaceServiceProxyError>!
|
||||
var joinedParentsChildIDReturnValue: Result<[SpaceServiceRoomProtocol], SpaceServiceProxyError>! {
|
||||
var joinedParentsChildIDUnderlyingReturnValue: Result<[SpaceServiceRoom], SpaceServiceProxyError>!
|
||||
var joinedParentsChildIDReturnValue: Result<[SpaceServiceRoom], SpaceServiceProxyError>! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return joinedParentsChildIDUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Result<[SpaceServiceRoomProtocol], SpaceServiceProxyError>? = nil
|
||||
var returnValue: Result<[SpaceServiceRoom], SpaceServiceProxyError>? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = joinedParentsChildIDUnderlyingReturnValue
|
||||
}
|
||||
@@ -17086,9 +17086,9 @@ class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
}
|
||||
var joinedParentsChildIDClosure: ((String) async -> Result<[SpaceServiceRoomProtocol], SpaceServiceProxyError>)?
|
||||
var joinedParentsChildIDClosure: ((String) async -> Result<[SpaceServiceRoom], SpaceServiceProxyError>)?
|
||||
|
||||
func joinedParents(childID: String) async -> Result<[SpaceServiceRoomProtocol], SpaceServiceProxyError> {
|
||||
func joinedParents(childID: String) async -> Result<[SpaceServiceRoom], SpaceServiceProxyError> {
|
||||
joinedParentsChildIDCallsCount += 1
|
||||
joinedParentsChildIDReceivedChildID = childID
|
||||
DispatchQueue.main.async {
|
||||
@@ -17130,13 +17130,13 @@ class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
return editableSpacesCallsCount > 0
|
||||
}
|
||||
|
||||
var editableSpacesUnderlyingReturnValue: [SpaceServiceRoomProtocol]!
|
||||
var editableSpacesReturnValue: [SpaceServiceRoomProtocol]! {
|
||||
var editableSpacesUnderlyingReturnValue: [SpaceServiceRoom]!
|
||||
var editableSpacesReturnValue: [SpaceServiceRoom]! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return editableSpacesUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: [SpaceServiceRoomProtocol]? = nil
|
||||
var returnValue: [SpaceServiceRoom]? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = editableSpacesUnderlyingReturnValue
|
||||
}
|
||||
@@ -17154,9 +17154,9 @@ class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
}
|
||||
var editableSpacesClosure: (() async -> [SpaceServiceRoomProtocol])?
|
||||
var editableSpacesClosure: (() async -> [SpaceServiceRoom])?
|
||||
|
||||
func editableSpaces() async -> [SpaceServiceRoomProtocol] {
|
||||
func editableSpaces() async -> [SpaceServiceRoom] {
|
||||
editableSpacesCallsCount += 1
|
||||
if let editableSpacesClosure = editableSpacesClosure {
|
||||
return await editableSpacesClosure()
|
||||
@@ -17305,49 +17305,6 @@ class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
}
|
||||
class SpaceServiceRoomMock: SpaceServiceRoomProtocol, @unchecked Sendable {
|
||||
var id: String {
|
||||
get { return underlyingId }
|
||||
set(value) { underlyingId = value }
|
||||
}
|
||||
var underlyingId: String!
|
||||
var name: String {
|
||||
get { return underlyingName }
|
||||
set(value) { underlyingName = value }
|
||||
}
|
||||
var underlyingName: String!
|
||||
var rawName: String?
|
||||
var avatarURL: URL?
|
||||
var isSpace: Bool {
|
||||
get { return underlyingIsSpace }
|
||||
set(value) { underlyingIsSpace = value }
|
||||
}
|
||||
var underlyingIsSpace: Bool!
|
||||
var isDirect: Bool?
|
||||
var childrenCount: Int {
|
||||
get { return underlyingChildrenCount }
|
||||
set(value) { underlyingChildrenCount = value }
|
||||
}
|
||||
var underlyingChildrenCount: Int!
|
||||
var joinedMembersCount: Int {
|
||||
get { return underlyingJoinedMembersCount }
|
||||
set(value) { underlyingJoinedMembersCount = value }
|
||||
}
|
||||
var underlyingJoinedMembersCount: Int!
|
||||
var heroes: [UserProfileProxy] = []
|
||||
var topic: String?
|
||||
var canonicalAlias: String?
|
||||
var joinRule: JoinRule?
|
||||
var worldReadable: Bool?
|
||||
var guestCanJoin: Bool {
|
||||
get { return underlyingGuestCanJoin }
|
||||
set(value) { underlyingGuestCanJoin = value }
|
||||
}
|
||||
var underlyingGuestCanJoin: Bool!
|
||||
var state: Membership?
|
||||
var via: [String] = []
|
||||
|
||||
}
|
||||
class StaticRoomSummaryProviderMock: StaticRoomSummaryProviderProtocol, @unchecked Sendable {
|
||||
var statePublisher: CurrentValuePublisher<RoomSummaryProviderState, Never> {
|
||||
get { return underlyingStatePublisher }
|
||||
|
||||
@@ -98,7 +98,7 @@ extension RoomPreviewProxyMock {
|
||||
underlyingOwnMembershipDetails = roomMembershipDetails
|
||||
}
|
||||
|
||||
convenience init(spaceServiceRoom: SpaceServiceRoomProtocol) {
|
||||
convenience init(spaceServiceRoom: SpaceServiceRoom) {
|
||||
self.init(Configuration(roomID: spaceServiceRoom.id,
|
||||
canonicalAlias: spaceServiceRoom.canonicalAlias ?? "",
|
||||
name: spaceServiceRoom.name,
|
||||
|
||||
@@ -23,11 +23,11 @@ extension LeaveSpaceHandleSDKMock {
|
||||
}
|
||||
|
||||
extension [LeaveSpaceRoom] {
|
||||
static func mockRoomsWithSpace(spaceServiceRoom: SpaceServiceRoomProtocol, isLastOwner: Bool) -> [LeaveSpaceRoom] {
|
||||
static func mockRoomsWithSpace(spaceServiceRoom: SpaceServiceRoom, isLastOwner: Bool) -> [LeaveSpaceRoom] {
|
||||
mockRooms + mockSingleSpace(spaceServiceRoom: spaceServiceRoom, isLastOwner: isLastOwner)
|
||||
}
|
||||
|
||||
static func mockSingleSpace(spaceServiceRoom: SpaceServiceRoomProtocol, isLastOwner: Bool) -> [LeaveSpaceRoom] {
|
||||
static func mockSingleSpace(spaceServiceRoom: SpaceServiceRoom, isLastOwner: Bool) -> [LeaveSpaceRoom] {
|
||||
[LeaveSpaceRoom(spaceRoom: SpaceRoom(id: spaceServiceRoom.id,
|
||||
name: spaceServiceRoom.name,
|
||||
avatarURL: spaceServiceRoom.avatarURL,
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
//
|
||||
// Copyright 2025 Element Creations Ltd.
|
||||
// Copyright 2025 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
extension SpaceServiceRoomMock {
|
||||
struct Configuration {
|
||||
var id: String = UUID().uuidString
|
||||
var name: String?
|
||||
var rawName: String?
|
||||
var avatarURL: URL?
|
||||
|
||||
var isSpace: Bool
|
||||
var isDirect: Bool?
|
||||
var childrenCount = 0
|
||||
|
||||
var joinedMembersCount = 0
|
||||
var heroes: [UserProfileProxy] = []
|
||||
var topic: String?
|
||||
var canonicalAlias: String?
|
||||
|
||||
var joinRule: JoinRule?
|
||||
var worldReadable: Bool?
|
||||
var guestCanJoin = true
|
||||
var state: Membership?
|
||||
}
|
||||
|
||||
convenience init(_ configuration: Configuration) {
|
||||
self.init()
|
||||
|
||||
id = configuration.id
|
||||
name = configuration.name ?? configuration.id
|
||||
rawName = configuration.rawName
|
||||
avatarURL = configuration.avatarURL
|
||||
isSpace = configuration.isSpace
|
||||
isDirect = configuration.isDirect
|
||||
childrenCount = configuration.childrenCount
|
||||
joinedMembersCount = configuration.joinedMembersCount
|
||||
heroes = configuration.heroes
|
||||
topic = configuration.topic
|
||||
canonicalAlias = configuration.canonicalAlias
|
||||
joinRule = configuration.joinRule
|
||||
worldReadable = configuration.worldReadable
|
||||
guestCanJoin = configuration.guestCanJoin
|
||||
state = configuration.state
|
||||
}
|
||||
}
|
||||
|
||||
extension [SpaceServiceRoomProtocol] {
|
||||
static var mockJoinedSpaces: [SpaceServiceRoomMock] {
|
||||
[
|
||||
SpaceServiceRoomMock(.init(id: "space1",
|
||||
name: "The Foundation",
|
||||
isSpace: true,
|
||||
childrenCount: 1,
|
||||
joinedMembersCount: 500,
|
||||
canonicalAlias: "#the-foundation:matrix.org",
|
||||
state: .joined)),
|
||||
SpaceServiceRoomMock(.init(id: "space2",
|
||||
name: "The Second Foundation",
|
||||
isSpace: true,
|
||||
childrenCount: 1,
|
||||
joinedMembersCount: 100,
|
||||
state: .joined)),
|
||||
SpaceServiceRoomMock(.init(id: "space3",
|
||||
name: "The Galactic Empire",
|
||||
isSpace: true,
|
||||
childrenCount: 25000,
|
||||
joinedMembersCount: 1_000_000_000,
|
||||
canonicalAlias: "#the-galactic-empire:matrix.org",
|
||||
state: .joined)),
|
||||
SpaceServiceRoomMock(.init(id: "space4",
|
||||
name: "The Korellians",
|
||||
isSpace: true,
|
||||
childrenCount: 27,
|
||||
joinedMembersCount: 2_000_000,
|
||||
state: .joined)),
|
||||
SpaceServiceRoomMock(.init(id: "space5",
|
||||
name: "The Luminists",
|
||||
isSpace: true,
|
||||
childrenCount: 1,
|
||||
joinedMembersCount: 100_000,
|
||||
state: .joined)),
|
||||
SpaceServiceRoomMock(.init(id: "space6",
|
||||
name: "The Anacreons",
|
||||
isSpace: true,
|
||||
childrenCount: 25,
|
||||
joinedMembersCount: 400_000,
|
||||
state: .joined)),
|
||||
SpaceServiceRoomMock(.init(id: "space7",
|
||||
name: "The Thespians",
|
||||
isSpace: true,
|
||||
childrenCount: 15,
|
||||
joinedMembersCount: 300_000,
|
||||
state: .joined))
|
||||
]
|
||||
}
|
||||
|
||||
static var mockJoinedSpaces2: [SpaceServiceRoomMock] {
|
||||
[
|
||||
SpaceServiceRoomMock(.init(id: "space1",
|
||||
name: "The Foundation",
|
||||
avatarURL: .mockMXCAvatar,
|
||||
isSpace: true,
|
||||
childrenCount: 1,
|
||||
joinedMembersCount: 500,
|
||||
canonicalAlias: "#the-foundation:matrix.org",
|
||||
joinRule: .private,
|
||||
state: .joined)),
|
||||
SpaceServiceRoomMock(.init(id: "space2",
|
||||
name: "The Second Foundation",
|
||||
isSpace: true,
|
||||
childrenCount: 1,
|
||||
joinedMembersCount: 100,
|
||||
state: .joined)),
|
||||
SpaceServiceRoomMock(.init(id: "space3",
|
||||
name: "The Galactic Empire",
|
||||
isSpace: true,
|
||||
childrenCount: 25000,
|
||||
joinedMembersCount: 1_000_000_000,
|
||||
canonicalAlias: "#the-galactic-empire:matrix.org",
|
||||
state: .joined))
|
||||
]
|
||||
}
|
||||
|
||||
static var mockSpaceList: [SpaceServiceRoomProtocol] {
|
||||
makeSpaceRooms(isSpace: true) + makeSpaceRooms(isSpace: false)
|
||||
}
|
||||
|
||||
static var mockSingleRoom: [SpaceServiceRoomProtocol] {
|
||||
[SpaceServiceRoomMock(.init(id: "!spaceroom:matrix.org",
|
||||
name: "Management",
|
||||
isSpace: false,
|
||||
joinedMembersCount: 12,
|
||||
topic: "This is where everything gets organised 📋.",
|
||||
state: .joined))]
|
||||
}
|
||||
|
||||
private static func makeSpaceRooms(isSpace: Bool) -> [SpaceServiceRoomMock] {
|
||||
let typeName = isSpace ? "Space" : "Room"
|
||||
|
||||
return [
|
||||
SpaceServiceRoomMock(.init(id: "!\(typeName.lowercased())1:matrix.org",
|
||||
name: "Company \(typeName)",
|
||||
isSpace: isSpace)),
|
||||
SpaceServiceRoomMock(.init(id: "!\(typeName.lowercased())2:matrix.org",
|
||||
name: "Public \(typeName)",
|
||||
avatarURL: .mockMXCAvatar,
|
||||
isSpace: isSpace,
|
||||
joinedMembersCount: 78,
|
||||
topic: "Discussion on specific topic goes here.",
|
||||
joinRule: .public)),
|
||||
SpaceServiceRoomMock(.init(id: "!\(typeName.lowercased())3:matrix.org",
|
||||
name: "Joined \(typeName)",
|
||||
isSpace: isSpace,
|
||||
joinedMembersCount: 123,
|
||||
topic: "Discussion on specific topic goes here.",
|
||||
joinRule: .restricted(rules: []),
|
||||
state: .joined))
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
extension SpaceServiceRoomMock {
|
||||
convenience init(mode: JoinRoomScreenMode) {
|
||||
var state: Membership?
|
||||
var joinRule: JoinRule?
|
||||
|
||||
switch mode {
|
||||
case .joinable:
|
||||
joinRule = .public
|
||||
case .restricted:
|
||||
joinRule = .restricted(rules: [])
|
||||
case .inviteRequired:
|
||||
joinRule = .private
|
||||
case .invited:
|
||||
state = .invited
|
||||
joinRule = .private
|
||||
case .knockable:
|
||||
joinRule = .knock
|
||||
case .knocked:
|
||||
state = .knocked
|
||||
joinRule = .knock
|
||||
case .banned:
|
||||
state = .banned
|
||||
case .loading, .unknown, .forbidden:
|
||||
break
|
||||
}
|
||||
|
||||
self.init(.init(id: "1",
|
||||
name: "The Three-Body Problem",
|
||||
avatarURL: .mockMXCAvatar,
|
||||
isSpace: true,
|
||||
childrenCount: 100,
|
||||
joinedMembersCount: 123,
|
||||
heroes: [.mockAlice, .mockBob, .mockCharlie],
|
||||
topic: "“Science and technology were the only keys to opening the door to the future, and people approached science with the faith and sincerity of elementary school students.”",
|
||||
canonicalAlias: "#3-body-problem:matrix.org",
|
||||
joinRule: joinRule,
|
||||
state: state))
|
||||
}
|
||||
}
|
||||
@@ -12,15 +12,15 @@ import MatrixRustSDK
|
||||
|
||||
extension SpaceRoomListProxyMock {
|
||||
class Configuration {
|
||||
var spaceServiceRoom: SpaceServiceRoomProtocol
|
||||
var initialSpaceRooms: [SpaceServiceRoomProtocol]
|
||||
var spaceServiceRoom: SpaceServiceRoom
|
||||
var initialSpaceRooms: [SpaceServiceRoom]
|
||||
var paginationStateSubject: CurrentValueSubject<SpaceRoomListPaginationState, Never>
|
||||
var paginationResponses: [[SpaceServiceRoomProtocol]]
|
||||
var paginationResponses: [[SpaceServiceRoom]]
|
||||
|
||||
init(spaceServiceRoom: SpaceServiceRoomProtocol,
|
||||
initialSpaceRooms: [SpaceServiceRoomProtocol] = [],
|
||||
init(spaceServiceRoom: SpaceServiceRoom,
|
||||
initialSpaceRooms: [SpaceServiceRoom] = [],
|
||||
paginationStateSubject: CurrentValueSubject<SpaceRoomListPaginationState, Never> = .init(.idle(endReached: true)),
|
||||
paginationResponses: [[SpaceServiceRoomProtocol]] = []) {
|
||||
paginationResponses: [[SpaceServiceRoom]] = []) {
|
||||
self.spaceServiceRoom = spaceServiceRoom
|
||||
self.initialSpaceRooms = initialSpaceRooms
|
||||
self.paginationStateSubject = paginationStateSubject
|
||||
@@ -31,7 +31,7 @@ extension SpaceRoomListProxyMock {
|
||||
convenience init(_ configuration: Configuration) {
|
||||
self.init()
|
||||
|
||||
let spaceRoomsSubject: CurrentValueSubject<[SpaceServiceRoomProtocol], Never> = .init(configuration.initialSpaceRooms)
|
||||
let spaceRoomsSubject: CurrentValueSubject<[SpaceServiceRoom], Never> = .init(configuration.initialSpaceRooms)
|
||||
|
||||
id = configuration.spaceServiceRoom.id
|
||||
spaceServiceRoomPublisher = .init(configuration.spaceServiceRoom)
|
||||
|
||||
@@ -17,10 +17,10 @@ enum SpaceServiceProxyMockError: Error {
|
||||
|
||||
extension SpaceServiceProxyMock {
|
||||
struct Configuration {
|
||||
var topLevelSpaces: [SpaceServiceRoomProtocol] = []
|
||||
var topLevelSpaces: [SpaceServiceRoom] = []
|
||||
var spaceFilters: [SpaceServiceFilter] = []
|
||||
var joinedParentSpaces: [SpaceServiceRoomProtocol] = []
|
||||
var editableSpaces: [SpaceServiceRoomProtocol] = []
|
||||
var joinedParentSpaces: [SpaceServiceRoom] = []
|
||||
var editableSpaces: [SpaceServiceRoom] = []
|
||||
var spaceRoomLists: [String: SpaceRoomListProxyMock] = [:]
|
||||
var leaveSpaceRooms: [LeaveSpaceRoom] = []
|
||||
}
|
||||
@@ -55,16 +55,16 @@ extension SpaceServiceProxyMock {
|
||||
|
||||
extension SpaceServiceProxyMock.Configuration {
|
||||
static var populated: SpaceServiceProxyMock.Configuration {
|
||||
let spaceFilters = [SpaceServiceRoomProtocol].mockJoinedSpaces.reduce(into: [SpaceServiceFilter]()) { partialResult, spaceRoom in
|
||||
let spaceFilters = [SpaceServiceRoom].mockJoinedSpaces.reduce(into: [SpaceServiceFilter]()) { partialResult, spaceRoom in
|
||||
partialResult.append(SpaceServiceFilter(room: spaceRoom, level: 0, descendants: .init()))
|
||||
partialResult.append(SpaceServiceFilter(room: spaceRoom, level: 1, descendants: .init()))
|
||||
}
|
||||
|
||||
let spaceRoomLists = [SpaceServiceRoomProtocol].mockJoinedSpaces.map {
|
||||
let spaceRoomLists = [SpaceServiceRoom].mockJoinedSpaces.map {
|
||||
($0.id, SpaceRoomListProxyMock(.init(spaceServiceRoom: $0, initialSpaceRooms: .mockSpaceList)))
|
||||
}
|
||||
|
||||
let subSpaceRoomLists = [SpaceServiceRoomProtocol].mockSpaceList.map {
|
||||
let subSpaceRoomLists = [SpaceServiceRoom].mockSpaceList.map {
|
||||
($0.id, SpaceRoomListProxyMock(.init(spaceServiceRoom: $0, initialSpaceRooms: .mockSingleRoom)))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user