Skip to content

Commit cac9d67

Browse files
Added snapshot tests
1 parent 407c07c commit cac9d67

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

Sources/StreamChatSwiftUI/ChatChannel/Composer/Suggestions/InstantCommands/GiphyCommandHandler.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ public struct GiphyCommandHandler: CommandHandler {
6060
selectedRangeLocation: Binding<Int>,
6161
command: Binding<ComposerCommand?>,
6262
extraData: [String: Any]
63-
) {
64-
// Handled with attachment actions.
65-
}
63+
) { /* Handled with attachment actions. */ }
6664

6765
public func commandHandler(for command: ComposerCommand) -> CommandHandler? {
6866
nil

Sources/StreamChatSwiftUI/ChatChannel/MessageList/ImageAttachmentView.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,7 @@ struct LazyLoadingImage: View {
319319
var shouldSetFrame: Bool = true
320320
var imageTapped: ((Int) -> Void)? = nil
321321
var index: Int?
322-
var onImageLoaded: (UIImage) -> Void = { _ in
323-
// Default implementation.
324-
}
322+
var onImageLoaded: (UIImage) -> Void = { _ in /* Default implementation. */ }
325323

326324
var body: some View {
327325
ZStack {

Sources/StreamChatSwiftUI/ChatChannel/Reactions/ReactionsOverlayView.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,8 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
4646
messageActionsCount = factory.supportedMessageActions(
4747
for: messageDisplayInfo.message,
4848
channel: channel,
49-
onFinish: { _ in
50-
// No handling needed.
51-
},
52-
onError: { _ in
53-
// No handling needed.
54-
}
49+
onFinish: { _ in /* No handling needed. */ },
50+
onError: { _ in /* No handling needed. */ }
5551
).count
5652
}
5753

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListView.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,7 @@ public struct ChatChannelListContentView<Factory: ViewFactory>: View {
215215
channelDestination: viewFactory.makeChannelDestination(),
216216
trailingSwipeRightButtonTapped: viewModel.onDeleteTapped(channel:),
217217
trailingSwipeLeftButtonTapped: viewModel.onMoreTapped(channel:),
218-
leadingSwipeButtonTapped: { _ in
219-
// No leading button by default.
220-
}
218+
leadingSwipeButtonTapped: { _ in /* No leading button by default. */ }
221219
)
222220
}
223221

StreamChatSwiftUITests/Tests/ChatChannel/MessageView_Tests.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,27 @@ class MessageView_Tests: StreamChatTestCase {
277277
// Then
278278
assertSnapshot(matching: view, as: .image)
279279
}
280+
281+
func test_deletedMessageViewContainer_snapshot() {
282+
// Given
283+
let message = ChatMessage.mock(
284+
id: .unique,
285+
cid: .unique,
286+
text: "Deleted message",
287+
author: .mock(id: .unique)
288+
)
289+
290+
// When
291+
let view = MessageView(
292+
factory: DefaultViewFactory.shared,
293+
message: message,
294+
contentWidth: defaultScreenSize.width,
295+
isFirst: true,
296+
scrolledId: .constant(nil)
297+
)
298+
.applyDefaultSize()
299+
300+
// Then
301+
assertSnapshot(matching: view, as: .image)
302+
}
280303
}
Loading

0 commit comments

Comments
 (0)