guardia-messenger/node_modules/expo-modules-core/ios/Tests/SharedRefSpec.swift
DESKTOP-TKLFCPRython f29f525c77 refactor: 101.79.17.164 → zioinfo.co.kr 전체 도메인 변환 + Manager UI 배포
- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스)
- Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포
- 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:09:17 +09:00

61 lines
1.7 KiB
Swift

import ExpoModulesTestCore
@testable import ExpoModulesCore
final class SharedRefSpec: ExpoSpec {
override class func spec() {
let appContext = AppContext.create()
let runtime = try! appContext.runtime
beforeSuite {
appContext.moduleRegistry.register(moduleType: FirstModule.self)
appContext.moduleRegistry.register(moduleType: SecondModule.self)
}
it("is a shared object") {
expect(SharedRef<UIImage>.self is SharedObject.Type)
}
it("has dynamic type for shared objects") {
let dynamicType = ~SharedRef<UIImage>.self
expect(dynamicType is DynamicSharedObjectType) == true
}
it("creates shared data") {
let result = try runtime.eval("expo.modules.FirstModule.createSharedData('\(sharedDataString)')")
expect(result.kind) == .object
}
it("shares Data object") {
let result = try runtime.eval([
"sharedData = expo.modules.FirstModule.createSharedData('\(sharedDataString)')",
"expo.modules.SecondModule.stringFromSharedData(sharedData)"
])
expect(result.kind) == .string
expect(try result.asString()) == sharedDataString
}
}
}
private let sharedDataString = "I can be shared among independent modules"
private class FirstModule: Module {
public func definition() -> ModuleDefinition {
Function("createSharedData") { (string: String) -> SharedRef<Data> in
let data = Data(string.utf8)
return SharedRef<Data>(data)
}
}
}
private class SecondModule: Module {
public func definition() -> ModuleDefinition {
Function("stringFromSharedData") { (data: SharedRef<Data>) -> String in
return String(decoding: data.pointer, as: UTF8.self)
}
}
}