-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use AppSettings.fileUploadConfig for setting supported UTI types for …
…the file picker (#713)
- Loading branch information
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
StreamChatSwiftUITests/Tests/ChatChannel/FilePickerView_Tests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// Copyright © 2025 Stream.io Inc. All rights reserved. | ||
// | ||
|
||
@testable import StreamChat | ||
@testable import StreamChatSwiftUI | ||
@testable import StreamChatTestTools | ||
import UniformTypeIdentifiers | ||
import XCTest | ||
|
||
final class FilePickerView_Tests: StreamChatTestCase { | ||
func test_openingContentTypes_default() { | ||
let picker = FilePickerView(fileURLs: .constant([])) | ||
XCTAssertEqual(picker.openingContentTypes, [UTType.item]) | ||
} | ||
|
||
func test_openingContentTypes_allowedLists() { | ||
chatClient.mockedAppSettings = .mock(fileUploadConfig: .mock(allowedFileExtensions: [".pdf"])) | ||
XCTAssertEqual(FilePickerView(fileURLs: .constant([])).openingContentTypes, [UTType.pdf]) | ||
|
||
chatClient.mockedAppSettings = .mock(fileUploadConfig: .mock(allowedMimeTypes: ["audio/mp3"])) | ||
XCTAssertEqual(FilePickerView(fileURLs: .constant([])).openingContentTypes, [UTType.mp3]) | ||
} | ||
} |