Files
AFFiNE-Mirror/packages/frontend/apps/ios/App/AppTests/ShareInboxSafetyTests.swift
T
keepClamDown 329839e467 feat(ios): add share to support (#15340)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
  * Added iOS sharing for URLs, text, web pages, and images.
* Shared content can be reviewed, titled, and saved to an AFFiNE
workspace.
  * Choose destinations including workspaces, tags, and collections.
* Added previews, attachment handling, import status, retry support, and
success/error feedback.
* Pending shares are processed when AFFiNE opens or returns to the
foreground.
* **Bug Fixes**
* Improved workspace profile handling across different workspace types.
* Onboarding completion is now recorded immediately after successful
sign-in verification.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
2026-08-27 19:09:51 +08:00

28 lines
975 B
Swift

import XCTest
final class ShareInboxSafetyTests: XCTestCase {
func testManifestIDsMustBeUUIDs() {
let id = UUID().uuidString
XCTAssertEqual(ShareInboxSafety.normalizedManifestID(id.lowercased()), id)
XCTAssertNil(ShareInboxSafety.normalizedManifestID("../item"))
XCTAssertNil(ShareInboxSafety.normalizedManifestID("nested/item"))
}
func testWebURLsRejectCredentialsAndUnsupportedSchemes() {
XCTAssertEqual(
ShareInboxSafety.normalizedWebURL("https://example.com/page"),
"https://example.com/page"
)
XCTAssertNil(ShareInboxSafety.normalizedWebURL("file:///private/item"))
XCTAssertNil(ShareInboxSafety.normalizedWebURL("https://user@example.com/page"))
}
func testSupportedImagesAreDetectedByContent() {
XCTAssertEqual(
ShareInboxSafety.detectRasterImageMimeType(Data([0xFF, 0xD8, 0xFF, 0x00])),
"image/jpeg"
)
XCTAssertNil(ShareInboxSafety.detectRasterImageMimeType(Data("<svg/>".utf8)))
}
}