// 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: async. final class AsyncTests: XCTestCase { override class func setUp() { super.setUp() let _testDocs = URL(fileURLWithPath: #filePath) .deletingLastPathComponent() // Tests/ .deletingLastPathComponent() // Tests/ .deletingLastPathComponent() // swift/ .deletingLastPathComponent() // packages/ .deletingLastPathComponent() // .appendingPathComponent("test_documents") if FileManager.default.fileExists(atPath: _testDocs.path) { FileManager.default.changeCurrentDirectoryPath(_testDocs.path) } } func testAsyncExtractBytes() throws { // Async extract_bytes call on PDF document let result = try Kreuzberg.extractBytes("pdf/fake_memo.pdf", "application/pdf", "{}") XCTAssertEqual(result.mimeType.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines), "application/pdf") XCTAssertGreaterThanOrEqual(result.content.count, 50) } func testAsyncExtractBytesEmptyMime() throws { // extract_bytes empty MIME async do { _ = try Kreuzberg.extractBytes("text/plain.txt", "", "{}") XCTFail("expected to throw") } catch { // success } } func testAsyncExtractBytesInvalidMime() throws { // extract_bytes unsupported MIME async do { _ = try Kreuzberg.extractBytes("text/plain.txt", "application/x-nonexistent", "{}") XCTFail("expected to throw") } catch { // success } } }