Signal-iOS/SignalServiceKit/tests/Util/FeatureFlagsTests.swift
2022-04-18 16:28:01 -07:00

39 lines
1.0 KiB
Swift

//
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import Foundation
import XCTest
@testable import SignalServiceKit
class FeatureFlagsTests: XCTestCase {
/// Test that all `@objc static let` properties are fetched from `TestFlags`.
func testAllFlags() {
let expectedKeys = [
"trueProperty",
"falseProperty",
"testableFlag"
]
let actualKeys = Array(TestFlags.allFlags().keys)
XCTAssertEqual(actualKeys.sorted(), expectedKeys.sorted())
}
/// Test that the correct number of properties with type `FeatureFlag` are returned.
func testAllTestableFlags() {
XCTAssertEqual(TestFlags.allTestableFlags().count, 1)
}
}
class TestFlags: BaseFlags {
@objc
public static let trueProperty = true
@objc
public static let falseProperty = false
// This can be any TestableFlag -- if this one is removed, just pick another.
@objc
public static let testableFlag = DebugFlags.disableMessageProcessing
}