Skip to content

Commit

Permalink
ArrayIndexConfiguration explicit expressions arg on set (#3342)
Browse files Browse the repository at this point in the history
  • Loading branch information
velicuvlad authored Nov 5, 2024
1 parent 72b9f86 commit a02e290
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Swift/IndexConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public struct ArrayIndexConfiguration: IndexConfiguration, IndexConfigConvertabl
/// represents an expression defining the values within the array to be indexed.
/// If the array specified by the path contains scalar values, this parameter can be null.
/// - Returns The ArrayIndexConfiguration object.
public init(path: String, _ expressions: [String]? = nil) {
public init(path: String, expressions: [String]? = nil) {
if let expressions = expressions {
if expressions.isEmpty || (expressions.count == 1 && expressions[0].isEmpty) {
NSException(name: .invalidArgumentException,
Expand Down
6 changes: 3 additions & 3 deletions Swift/Tests/UnnestArrayTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class UnnestArrayTest: CBLTestCase {
/// 2. Check that an invalid arument exception is thrown.
func testArrayIndexConfigInvalidExpressions() throws {
expectException(exception: .invalidArgumentException) {
_ = ArrayIndexConfiguration(path: "contacts", [])
_ = ArrayIndexConfiguration(path: "contacts", expressions: [])
}

expectException(exception: .invalidArgumentException) {
_ = ArrayIndexConfiguration(path: "contacts", [""])
_ = ArrayIndexConfiguration(path: "contacts", expressions: [""])
}
}

Expand Down Expand Up @@ -76,7 +76,7 @@ class UnnestArrayTest: CBLTestCase {
func testCreateArrayIndexWithPathAndExpressions() throws {
let profiles = try db.createCollection(name: "profiles")
try loadJSONResource("profiles_100", collection: profiles)
let config = ArrayIndexConfiguration(path: "contacts", ["address.city", "address.state"])
let config = ArrayIndexConfiguration(path: "contacts",expressions: ["address.city", "address.state"])
try profiles.createIndex(withName: "contacts", config: config)
let indexes = try profiles.indexesInfo()
XCTAssertEqual(indexes!.count, 1)
Expand Down

0 comments on commit a02e290

Please sign in to comment.