Skip to content

Commit

Permalink
add list collection integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anitarua committed Nov 30, 2023
1 parent cdd69c6 commit 5a225ed
Show file tree
Hide file tree
Showing 4 changed files with 1,442 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Sources/momento/CacheClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ public class CacheClient: CacheClientProtocol {
do {
try validateCacheName(cacheName: cacheName)
try validateListName(listName: listName)
try validateTruncateSize(size: truncateFrontToSize)
try validateTtl(ttl: ttl)
} catch let err as SdkError {
return CacheListPushBackError(error: err)
Expand Down Expand Up @@ -497,6 +498,7 @@ public class CacheClient: CacheClientProtocol {
do {
try validateCacheName(cacheName: cacheName)
try validateListName(listName: listName)
try validateTruncateSize(size: truncateBackToSize)
try validateTtl(ttl: ttl)
} catch let err as SdkError {
return CacheListPushFrontError(error: err)
Expand Down
2 changes: 1 addition & 1 deletion Sources/momento/internal/utils/Validators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal func validateListSliceStartEnd(startIndex: Int?, endIndex: Int?) throws
if startIndex == nil || endIndex == nil {
return
}
if startIndex! > 0 || endIndex! < 0 {
if startIndex! > 0 && endIndex! < 0 {
return
}
if endIndex! <= startIndex! {
Expand Down
2 changes: 0 additions & 2 deletions Tests/momentoTests/cacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import XCTest

final class cacheTests: XCTestCase {
private var integrationTestCacheName: String!
private var topicClient: TopicClientProtocol!
private var cacheClient: CacheClientProtocol!

override func setUp() async throws {
let testSetup = await setUpIntegrationTests()
self.integrationTestCacheName = testSetup.cacheName
self.topicClient = testSetup.topicClient
self.cacheClient = testSetup.cacheClient
}

Expand Down
Loading

0 comments on commit 5a225ed

Please sign in to comment.