@@ -71,7 +71,7 @@ final class GenerativeModelTests: XCTestCase {
71
71
XCTAssertEqual ( candidate. content. parts. count, 1 )
72
72
let part = try XCTUnwrap ( candidate. content. parts. first)
73
73
let partText = try XCTUnwrap ( part. text)
74
- XCTAssertTrue ( partText. hasPrefix ( " You can ask me a wide range of questions " ) )
74
+ XCTAssertTrue ( partText. hasPrefix ( " 1. **Use Freshly Ground Coffee**: " ) )
75
75
XCTAssertEqual ( response. text, partText)
76
76
XCTAssertEqual ( response. functionCalls, [ ] )
77
77
}
@@ -92,7 +92,7 @@ final class GenerativeModelTests: XCTestCase {
92
92
XCTAssertEqual ( candidate. safetyRatings. sorted ( ) , safetyRatingsNegligible)
93
93
XCTAssertEqual ( candidate. content. parts. count, 1 )
94
94
let part = try XCTUnwrap ( candidate. content. parts. first)
95
- XCTAssertEqual ( part. text, " Mountain View, California, United States " )
95
+ XCTAssertEqual ( part. text, " Mountain View, California " )
96
96
XCTAssertEqual ( response. text, part. text)
97
97
XCTAssertEqual ( response. functionCalls, [ ] )
98
98
}
@@ -506,7 +506,7 @@ final class GenerativeModelTests: XCTestCase {
506
506
XCTFail ( " Should throw " )
507
507
} catch let GenerateContentError . responseStoppedEarly( reason, response) {
508
508
XCTAssertEqual ( reason, . safety)
509
- XCTAssertEqual ( response. text, " No " )
509
+ XCTAssertEqual ( response. text, " <redacted> " )
510
510
} catch {
511
511
XCTFail ( " Should throw a responseStoppedEarly " )
512
512
}
@@ -888,7 +888,7 @@ final class GenerativeModelTests: XCTestCase {
888
888
responses += 1
889
889
}
890
890
891
- XCTAssertEqual ( responses, 8 )
891
+ XCTAssertEqual ( responses, 6 )
892
892
}
893
893
894
894
func testGenerateContentStream_successBasicReplyShort( ) async throws {
@@ -949,18 +949,14 @@ final class GenerativeModelTests: XCTestCase {
949
949
950
950
let lastCandidate = try XCTUnwrap ( responses. last? . candidates. first)
951
951
XCTAssertEqual ( lastCandidate. finishReason, . stop)
952
- XCTAssertEqual ( citations. count, 3 )
952
+ XCTAssertEqual ( citations. count, 6 )
953
953
XCTAssertTrue ( citations
954
954
. contains ( where: {
955
- $0. startIndex == 0 && $0. endIndex == 128 && !$0. uri. isEmpty && $0. license == nil
955
+ $0. startIndex == 574 && $0. endIndex == 705 && !$0. uri. isEmpty && $0. license == " "
956
956
} ) )
957
957
XCTAssertTrue ( citations
958
958
. contains ( where: {
959
- $0. startIndex == 130 && $0. endIndex == 265 && !$0. uri. isEmpty && $0. license == nil
960
- } ) )
961
- XCTAssertTrue ( citations
962
- . contains ( where: {
963
- $0. startIndex == 272 && $0. endIndex == 431 && !$0. uri. isEmpty && $0. license == " mit "
959
+ $0. startIndex == 899 && $0. endIndex == 1026 && !$0. uri. isEmpty && $0. license == " "
964
960
} ) )
965
961
}
966
962
@@ -1159,7 +1155,7 @@ final class GenerativeModelTests: XCTestCase {
1159
1155
1160
1156
func testCountTokens_succeeds( ) async throws {
1161
1157
MockURLProtocol . requestHandler = try httpRequestHandler (
1162
- forResource: " success-total-tokens " ,
1158
+ forResource: " unary- success-total-tokens" ,
1163
1159
withExtension: " json "
1164
1160
)
1165
1161
@@ -1171,7 +1167,7 @@ final class GenerativeModelTests: XCTestCase {
1171
1167
1172
1168
func testCountTokens_succeeds_noBillableCharacters( ) async throws {
1173
1169
MockURLProtocol . requestHandler = try httpRequestHandler (
1174
- forResource: " success-no-billable-characters " ,
1170
+ forResource: " unary- success-no-billable-characters" ,
1175
1171
withExtension: " json "
1176
1172
)
1177
1173
@@ -1186,7 +1182,7 @@ final class GenerativeModelTests: XCTestCase {
1186
1182
1187
1183
func testCountTokens_modelNotFound( ) async throws {
1188
1184
MockURLProtocol . requestHandler = try httpRequestHandler (
1189
- forResource: " failure-model-not-found " , withExtension: " json " ,
1185
+ forResource: " unary- failure-model-not-found" , withExtension: " json " ,
1190
1186
statusCode: 404
1191
1187
)
1192
1188
@@ -1207,7 +1203,7 @@ final class GenerativeModelTests: XCTestCase {
1207
1203
let expectedTimeout = 150.0
1208
1204
MockURLProtocol
1209
1205
. requestHandler = try httpRequestHandler (
1210
- forResource: " success-total-tokens " ,
1206
+ forResource: " unary- success-total-tokens" ,
1211
1207
withExtension: " json " ,
1212
1208
timeout: expectedTimeout
1213
1209
)
0 commit comments