This commit is contained in:
62
e2e/swift_e2e/Tests/KreuzbergE2ETests/FormatSpecificTests.swift
generated
Normal file
62
e2e/swift_e2e/Tests/KreuzbergE2ETests/FormatSpecificTests.swift
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
// 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: format_specific.
|
||||
final class FormatSpecificTests: 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 testFormatDocxStandalone() throws {
|
||||
// Standalone DOCX extraction using extract_bytes_sync
|
||||
let result = try Kreuzberg.extractBytesSync("docx/fake.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "{}")
|
||||
XCTAssertGreaterThanOrEqual(result.content.count, 20)
|
||||
}
|
||||
|
||||
func testFormatHwpxStandalone() throws {
|
||||
// Standalone HWPX extraction using extract_bytes_sync
|
||||
let result = try Kreuzberg.extractBytesSync("hwpx/simple.hwpx", "application/haansofthwpx", "{}")
|
||||
XCTAssertGreaterThanOrEqual(result.content.count, 20)
|
||||
XCTAssertTrue("Hello from HWPX".isEmpty || result.content.contains("Hello from HWPX"), "expected to contain: \("Hello from HWPX")")
|
||||
}
|
||||
|
||||
func testFormatPdfText() throws {
|
||||
// Standalone PDF text extraction using extract_bytes_sync
|
||||
let result = try Kreuzberg.extractBytesSync("pdf/fake_memo.pdf", "application/pdf", "{}")
|
||||
XCTAssertGreaterThanOrEqual(result.content.count, 50)
|
||||
XCTAssertTrue(result.content.contains("Mallori") || result.content.contains("May"), "expected to contain at least one of the specified values")
|
||||
}
|
||||
|
||||
func testFormatPptx() throws {
|
||||
// PPTX presentation extraction using extract_file_sync
|
||||
let result = try Kreuzberg.extractFileSync("pptx/simple.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "{}")
|
||||
}
|
||||
|
||||
func testFormatXlsx() throws {
|
||||
// XLSX spreadsheet extraction using extract_file_sync
|
||||
let result = try Kreuzberg.extractFileSync("xlsx/stanley_cups.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "{}")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user