|
39 | 39 | // TODO: Create separate files for each class tested.
|
40 | 40 | final class ModelDownloaderUnitTests: XCTestCase {
|
41 | 41 | let fakeModelName = "fakeModelName"
|
42 |
| - let fakemodelPath = "fakemodelPath" |
| 42 | + let fakeModelPath = "fakeModelPath" |
43 | 43 | let fakeModelHash = "fakeModelHash"
|
44 | 44 | let fakeDownloadURL = URL(string: "www.fake-download-url.com")!
|
45 | 45 | let fakeFileURL = URL(string: "www.fake-model-file.com")!
|
|
269 | 269 | let fakeModel = CustomModel(
|
270 | 270 | name: fakeModelName,
|
271 | 271 | size: 10,
|
272 |
| - path: fakemodelPath, |
| 272 | + path: fakeModelPath, |
273 | 273 | hash: fakeModelHash
|
274 | 274 | )
|
275 | 275 | var modelOptions = ModelOptions()
|
|
298 | 298 | modelInfoRetriever.downloadModelInfo { result in
|
299 | 299 | completionExpectation.fulfill()
|
300 | 300 | switch result {
|
301 |
| - case let .success(fakemodelInfoResult): |
302 |
| - switch fakemodelInfoResult { |
| 301 | + case let .success(fakeModelInfoResult): |
| 302 | + switch fakeModelInfoResult { |
303 | 303 | case let .modelInfo(remoteModelInfo):
|
304 | 304 | XCTAssertEqual(remoteModelInfo.name, self.fakeModelName)
|
305 | 305 | XCTAssertEqual(remoteModelInfo.downloadURL, self.fakeDownloadURL)
|
|
326 | 326 | modelInfoRetriever.downloadModelInfo { result in
|
327 | 327 | completionExpectation.fulfill()
|
328 | 328 | switch result {
|
329 |
| - case let .success(fakemodelInfoResult): |
330 |
| - switch fakemodelInfoResult { |
| 329 | + case let .success(fakeModelInfoResult): |
| 330 | + switch fakeModelInfoResult { |
331 | 331 | case .modelInfo: XCTFail("Unexpected new model info from server.")
|
332 | 332 | case .notModified: break
|
333 | 333 | }
|
|
346 | 346 | modelInfoRetriever.downloadModelInfo { result in
|
347 | 347 | completionExpectation.fulfill()
|
348 | 348 | switch result {
|
349 |
| - case let .success(fakemodelInfoResult): |
350 |
| - switch fakemodelInfoResult { |
| 349 | + case let .success(fakeModelInfoResult): |
| 350 | + switch fakeModelInfoResult { |
351 | 351 | case .modelInfo: XCTFail("Unexpected new model info from server.")
|
352 | 352 | case .notModified: XCTFail("Expected failure since local model info was not set.")
|
353 | 353 | }
|
|
375 | 375 | modelInfoRetriever.downloadModelInfo { result in
|
376 | 376 | completionExpectation.fulfill()
|
377 | 377 | switch result {
|
378 |
| - case let .success(fakemodelInfoResult): |
379 |
| - switch fakemodelInfoResult { |
| 378 | + case let .success(fakeModelInfoResult): |
| 379 | + switch fakeModelInfoResult { |
380 | 380 | case .modelInfo: XCTFail("Unexpected new model info from server.")
|
381 | 381 | case .notModified: XCTFail("Expected failure since model hash does not match.")
|
382 | 382 | }
|
|
404 | 404 | modelInfoRetriever.downloadModelInfo { result in
|
405 | 405 | completionExpectation.fulfill()
|
406 | 406 | switch result {
|
407 |
| - case let .success(fakemodelInfoResult): |
408 |
| - switch fakemodelInfoResult { |
| 407 | + case let .success(fakeModelInfoResult): |
| 408 | + switch fakeModelInfoResult { |
409 | 409 | case .modelInfo: XCTFail("Unexpected new model info from server.")
|
410 | 410 | case .notModified: XCTFail("Expected failure since model name is invalid.")
|
411 | 411 | }
|
|
429 | 429 | modelInfoRetriever.downloadModelInfo { result in
|
430 | 430 | completionExpectation.fulfill()
|
431 | 431 | switch result {
|
432 |
| - case let .success(fakemodelInfoResult): |
433 |
| - switch fakemodelInfoResult { |
| 432 | + case let .success(fakeModelInfoResult): |
| 433 | + switch fakeModelInfoResult { |
434 | 434 | case .modelInfo: XCTFail("Unexpected new model info from server.")
|
435 |
| - case .notModified: XCTFail("Expected failure since model name is not availabl.") |
| 435 | + case .notModified: XCTFail("Expected failure since model name is not available.") |
436 | 436 | }
|
437 | 437 | case let .failure(error):
|
438 | 438 | XCTAssertEqual(error, .notFound)
|
|
454 | 454 | modelInfoRetriever.downloadModelInfo { result in
|
455 | 455 | completionExpectation.fulfill()
|
456 | 456 | switch result {
|
457 |
| - case let .success(fakemodelInfoResult): |
458 |
| - switch fakemodelInfoResult { |
| 457 | + case let .success(fakeModelInfoResult): |
| 458 | + switch fakeModelInfoResult { |
459 | 459 | case .modelInfo: XCTFail("Unexpected new model info from server.")
|
460 | 460 | case .notModified: XCTFail("Expected failure since resource exhausted.")
|
461 | 461 | }
|
|
0 commit comments