This commit is contained in:
50
e2e/swift_e2e/Tests/KreuzbergE2ETests/MimeUtilitiesTests.swift
generated
Normal file
50
e2e/swift_e2e/Tests/KreuzbergE2ETests/MimeUtilitiesTests.swift
generated
Normal file
@@ -0,0 +1,50 @@
|
||||
// This file is auto-generated by alef — DO NOT EDIT.
|
||||
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
||||
// To regenerate: alef generate
|
||||
// To verify freshness: alef verify --exit-code
|
||||
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
||||
// swift-format-ignore-file
|
||||
|
||||
import XCTest
|
||||
import Foundation
|
||||
#if canImport(FoundationNetworking)
|
||||
import FoundationNetworking
|
||||
#endif
|
||||
import Kreuzberg
|
||||
import RustBridge
|
||||
|
||||
/// E2e tests for category: mime_utilities.
|
||||
final class MimeUtilitiesTests: XCTestCase {
|
||||
override class func setUp() {
|
||||
super.setUp()
|
||||
let _testDocs = URL(fileURLWithPath: #filePath)
|
||||
.deletingLastPathComponent() // <Module>Tests/
|
||||
.deletingLastPathComponent() // Tests/
|
||||
.deletingLastPathComponent() // swift/
|
||||
.deletingLastPathComponent() // packages/
|
||||
.deletingLastPathComponent() // <repo root>
|
||||
.appendingPathComponent("test_documents")
|
||||
if FileManager.default.fileExists(atPath: _testDocs.path) {
|
||||
FileManager.default.changeCurrentDirectoryPath(_testDocs.path)
|
||||
}
|
||||
}
|
||||
|
||||
func testMimeDetectBytes() throws {
|
||||
// Detect MIME type from file bytes
|
||||
let result = try Kreuzberg.detectMimeTypeFromBytes("pdf/fake_memo.pdf")
|
||||
XCTAssertTrue("pdf".isEmpty || result.contains("pdf"), "expected to contain: \("pdf")")
|
||||
}
|
||||
|
||||
func testMimeDetectImage() throws {
|
||||
// Detect MIME type from PNG image bytes
|
||||
let result = try Kreuzberg.detectMimeTypeFromBytes("images/test_hello_world.png")
|
||||
XCTAssertTrue("png".isEmpty || result.contains("png"), "expected to contain: \("png")")
|
||||
}
|
||||
|
||||
func testMimeGetExtensions() throws {
|
||||
// Get file extensions for a MIME type
|
||||
let result = try Kreuzberg.getExtensionsForMime(mimeType: "application/pdf")
|
||||
XCTAssertTrue("pdf".isEmpty || result.contains("pdf"), "expected to contain: \("pdf")")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user