Files
fil/e2e/swift_e2e/Tests/KreuzbergE2ETests/CodeTests.swift
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

42 lines
1.7 KiB
Swift
Generated

// 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: code.
final class CodeTests: 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 testCodeShebangDetection() throws {
// Test language detection from shebang line via bytes input
let result = try Kreuzberg.extractFileSync("code/script.sh", "text/x-source-code", "{}")
XCTAssertEqual(result.mimeType.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines), "text/x-source-code")
XCTAssertGreaterThanOrEqual(result.content.count, 10)
XCTAssertTrue(result.content.contains("build"), "expected to contain: \("build")")
XCTAssertTrue(result.content.contains("clean"), "expected to contain: \("clean")")
}
}