forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatGPTServiceFieldTests.swift
More file actions
40 lines (31 loc) · 1.01 KB
/
ChatGPTServiceFieldTests.swift
File metadata and controls
40 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import XCTest
@testable import OpenAIService
final class ChatGPTServiceFieldTests: XCTestCase {
let skip = true
func test_calling_the_api() async throws {
let service = ChatGPTService()
if skip { return }
do {
let stream = try await service.send(content: "Hello")
for try await text in stream {
print(text)
}
} catch {
print("🔴", error.localizedDescription)
}
XCTFail("🔴 Please reset skip to true.")
}
func test_calling_the_api_with_function_calling() async throws {
let service = ChatGPTService()
if skip { return }
do {
let stream = try await service.send(content: "Hello")
for try await text in stream {
print(text)
}
} catch {
print("🔴", error.localizedDescription)
}
XCTFail("🔴 Please reset skip to true.")
}
}