-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [#69] Implemented a protocol-based initializer in `FeatureFlagResolver` (#70) * [#68] Added support for mutable `stores` in resolver configuration via a new implementation, `MutableFeatureFlagResolverConfiguration` (#72)
- Loading branch information
Showing
8 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
Sources/YMFF/FeatureFlagResolver/Configuration/MutableFeatureFlagResolverConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// MutableFeatureFlagResolverConfiguration.swift | ||
// YMFF | ||
// | ||
// Created by Yakov Manshin on 5/17/21. | ||
// Copyright © 2021 Yakov Manshin. See the LICENSE file for license info. | ||
// | ||
|
||
#if !COCOAPODS | ||
import YMFFProtocols | ||
#endif | ||
|
||
// MARK: - MutableFeatureFlagResolverConfiguration | ||
|
||
/// An object used to configure the resolver, which holds feature flag stores that can be changed. | ||
final public class MutableFeatureFlagResolverConfiguration { | ||
|
||
public var stores: [FeatureFlagStore] | ||
|
||
public init(stores: [FeatureFlagStore]) { | ||
self.stores = stores | ||
} | ||
|
||
} | ||
|
||
// MARK: - FeatureFlagResolverConfigurationProtocol | ||
|
||
extension MutableFeatureFlagResolverConfiguration: FeatureFlagResolverConfigurationProtocol { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
Tests/YMFFTests/FeatureFlagResolverConfigurationTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// FeatureFlagResolverConfigurationTests.swift | ||
// YMFF | ||
// | ||
// Created by Yakov Manshin on 5/17/21. | ||
// Copyright © 2021 Yakov Manshin. See the LICENSE file for license info. | ||
// | ||
|
||
import XCTest | ||
|
||
@testable import YMFF | ||
|
||
final class FeatureFlagResolverConfigurationTests: XCTestCase { | ||
|
||
func testStoreAdditionToMutableConfiguration() { | ||
let configuration = MutableFeatureFlagResolverConfiguration(stores: []) | ||
|
||
XCTAssertEqual(configuration.stores.count, 0) | ||
|
||
configuration.stores.append(.immutable(TransparentFeatureFlagStore())) | ||
|
||
XCTAssertEqual(configuration.stores.count, 1) | ||
} | ||
|
||
func testStoreRemovalFromMutableConfiguration() { | ||
let configuration = MutableFeatureFlagResolverConfiguration(stores: [.immutable(TransparentFeatureFlagStore())]) | ||
|
||
XCTAssertEqual(configuration.stores.count, 1) | ||
|
||
configuration.stores.removeAll() | ||
|
||
XCTAssertEqual(configuration.stores.count, 0) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters