From d6517280c01096ba7bad77c7fecab6e3fcbf99aa Mon Sep 17 00:00:00 2001 From: James Sherlock <15193942+Sherlouk@users.noreply.github.com> Date: Sun, 17 Sep 2023 11:50:41 +0100 Subject: [PATCH 1/2] Add `total` to TasksResult --- Sources/MeiliSearch/Model/TasksResults.swift | 2 ++ Tests/MeiliSearchIntegrationTests/TaskTests.swift | 1 + 2 files changed, 3 insertions(+) diff --git a/Sources/MeiliSearch/Model/TasksResults.swift b/Sources/MeiliSearch/Model/TasksResults.swift index aaca9ecc..a8e3f31a 100644 --- a/Sources/MeiliSearch/Model/TasksResults.swift +++ b/Sources/MeiliSearch/Model/TasksResults.swift @@ -13,4 +13,6 @@ public struct TasksResults: Codable, Equatable { public let from: Int? /// Max number of records to be returned in one request. public let limit: Int + /// The total number of tasks. + public let total: Int } diff --git a/Tests/MeiliSearchIntegrationTests/TaskTests.swift b/Tests/MeiliSearchIntegrationTests/TaskTests.swift index e108a145..70b7c9ba 100644 --- a/Tests/MeiliSearchIntegrationTests/TaskTests.swift +++ b/Tests/MeiliSearchIntegrationTests/TaskTests.swift @@ -75,6 +75,7 @@ class TasksTests: XCTestCase { case .success(let tasks): // Only one because index has been deleted and recreated XCTAssertEqual(tasks.results.count, 1) + XCTAssertEqual(tasks.total, 1) expectation.fulfill() case .failure(let error): dump(error) From 195e2bfb8b1374361540f7ef30fb0b67baf3d090 Mon Sep 17 00:00:00 2001 From: James Sherlock <15193942+Sherlouk@users.noreply.github.com> Date: Thu, 21 Sep 2023 23:26:03 +0100 Subject: [PATCH 2/2] Patch Unit Tests --- Tests/MeiliSearchUnitTests/IndexesTests.swift | 3 ++- Tests/MeiliSearchUnitTests/TasksTests.swift | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Tests/MeiliSearchUnitTests/IndexesTests.swift b/Tests/MeiliSearchUnitTests/IndexesTests.swift index c32c1f4b..07ea3877 100755 --- a/Tests/MeiliSearchUnitTests/IndexesTests.swift +++ b/Tests/MeiliSearchUnitTests/IndexesTests.swift @@ -240,7 +240,8 @@ class IndexesTests: XCTestCase { "results": [], "limit": 20, "from": 5, - "next": 98 + "next": 98, + "total": 4 } """ diff --git a/Tests/MeiliSearchUnitTests/TasksTests.swift b/Tests/MeiliSearchUnitTests/TasksTests.swift index d45df6f3..be36b7b4 100644 --- a/Tests/MeiliSearchUnitTests/TasksTests.swift +++ b/Tests/MeiliSearchUnitTests/TasksTests.swift @@ -20,7 +20,8 @@ class TasksTests: XCTestCase { "results": [], "limit": 20, "from": 5, - "next": 98 + "next": 98, + "total": 4 } """