Skip to content

Commit b00e1d7

Browse files
authored
chore(Predictions): Fixing integration test. (#2562)
1 parent 133a1fa commit b00e1d7

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

AmplifyPlugins/Predictions/AWSPredictionsPluginIntegrationTests/IdentifyBasicIntegrationTests.swift

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,33 @@ class IdentifyBasicIntegrationTests: AWSPredictionsPluginTestBase {
239239
XCTFail("Unable to find image")
240240
return
241241
}
242+
// These are all the words that should be recognized on the image.
243+
let expectedWords = [
244+
"Personal",
245+
"information",
246+
"First",
247+
"name",
248+
"AWS",
249+
"Middle",
250+
"Last",
251+
"Amazon",
252+
"Address",
253+
"410",
254+
"Terry",
255+
"Ave",
256+
"N",
257+
"City",
258+
"or",
259+
"Town",
260+
"Seattle",
261+
"State",
262+
"Choose",
263+
"a",
264+
"State",
265+
"Zip",
266+
"code",
267+
"98109"
268+
]
242269
let completeInvoked = expectation(description: "Completed is invoked")
243270

244271
let operation = Amplify.Predictions.identify(type: .detectText(.form),
@@ -252,7 +279,9 @@ class IdentifyBasicIntegrationTests: AWSPredictionsPluginTestBase {
252279
}
253280
XCTAssertFalse(data.fullText.isEmpty)
254281
XCTAssertFalse(data.words.isEmpty)
255-
XCTAssertEqual(data.words.count, 33)
282+
for word in expectedWords {
283+
XCTAssertTrue(data.words.contains(where: { $0.text.contains(word) }))
284+
}
256285
XCTAssertFalse(data.rawLineText.isEmpty)
257286
XCTAssertEqual(data.rawLineText.count, 17)
258287
XCTAssertFalse(data.identifiedLines.isEmpty)

0 commit comments

Comments
 (0)