From e23e9b369ee20a9439182b4314b5da21e5fced46 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 15 Mar 2021 11:07:11 -0400 Subject: [PATCH] 138 --- 0138-better-test-dependencies-pt1/README.md | 5 + .../Todos/README.md | 1 + .../Todos/Todos.xcodeproj/project.pbxproj | 501 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/xcschemes/Todos.xcscheme | 88 +++ .../AppIcon.appiconset/AppIcon.png | Bin 0 -> 8152 bytes .../AppIcon.appiconset/Contents.json | 99 ++++ .../Todos/Todos/Assets.xcassets/Contents.json | 6 + .../Todos/Todos/Info.plist | 60 +++ .../Todos/Todos/SceneDelegate.swift | 40 ++ .../Todos/Todos/Todo.swift | 49 ++ .../Todos/Todos/Todos.swift | 230 ++++++++ .../Todos/TodosTests/TodosTests.swift | 373 +++++++++++++ README.md | 1 + 15 files changed, 1468 insertions(+) create mode 100644 0138-better-test-dependencies-pt1/README.md create mode 100644 0138-better-test-dependencies-pt1/Todos/README.md create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.pbxproj create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/xcshareddata/xcschemes/Todos.xcscheme create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/AppIcon.appiconset/AppIcon.png create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/Contents.json create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos/Info.plist create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos/SceneDelegate.swift create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos/Todo.swift create mode 100644 0138-better-test-dependencies-pt1/Todos/Todos/Todos.swift create mode 100644 0138-better-test-dependencies-pt1/Todos/TodosTests/TodosTests.swift diff --git a/0138-better-test-dependencies-pt1/README.md b/0138-better-test-dependencies-pt1/README.md new file mode 100644 index 00000000..49573573 --- /dev/null +++ b/0138-better-test-dependencies-pt1/README.md @@ -0,0 +1,5 @@ +## [Point-Free](https://www.pointfree.co) + +> #### This directory contains code from Point-Free Episode: [Better Test Dependencies: Exhaustivity](https://www.pointfree.co/episodes/ep138-better-test-dependencies-exhaustivity) +> +> We talk about dependencies a lot on Point-Free, but we’ve never done a deep dive on how to tune them for testing. It’s time to do just that, by first showing how a test can exhaustively describe its dependencies, which comes with some incredible benefits. diff --git a/0138-better-test-dependencies-pt1/Todos/README.md b/0138-better-test-dependencies-pt1/Todos/README.md new file mode 100644 index 00000000..144ecba9 --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/README.md @@ -0,0 +1 @@ +# Todo Application diff --git a/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.pbxproj b/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.pbxproj new file mode 100644 index 00000000..3018e71f --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.pbxproj @@ -0,0 +1,501 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + CA93D060249BF4D000A6F65D /* Todo.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA93D05F249BF4D000A6F65D /* Todo.swift */; }; + DC67272A25FFAF6A00B47038 /* ComposableArchitecture in Frameworks */ = {isa = PBXBuildFile; productRef = DC67272925FFAF6A00B47038 /* ComposableArchitecture */; }; + DCBCB77624290F6C00DE1F59 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCBCB77524290F6C00DE1F59 /* SceneDelegate.swift */; }; + DCBCB77A24290F6D00DE1F59 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DCBCB77924290F6D00DE1F59 /* Assets.xcassets */; }; + DCBCB78B24290F6D00DE1F59 /* TodosTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCBCB78A24290F6D00DE1F59 /* TodosTests.swift */; }; + DCBCB79B24290FEB00DE1F59 /* Todos.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCBCB79A24290FEB00DE1F59 /* Todos.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + DCBCB78724290F6D00DE1F59 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = DCBCB76824290F6C00DE1F59 /* Project object */; + proxyType = 1; + remoteGlobalIDString = DCBCB76F24290F6C00DE1F59; + remoteInfo = Todos; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + DCBCB79924290FDA00DE1F59 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + DCF6E2D124296752002F8A8F /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + CA93D05F249BF4D000A6F65D /* Todo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Todo.swift; sourceTree = ""; }; + DCBCB77024290F6C00DE1F59 /* Todos.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Todos.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DCBCB77524290F6C00DE1F59 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + DCBCB77924290F6D00DE1F59 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + DCBCB78124290F6D00DE1F59 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DCBCB78624290F6D00DE1F59 /* TodosTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TodosTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + DCBCB78A24290F6D00DE1F59 /* TodosTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodosTests.swift; sourceTree = ""; }; + DCBCB79A24290FEB00DE1F59 /* Todos.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Todos.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DCBCB76D24290F6C00DE1F59 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DC67272A25FFAF6A00B47038 /* ComposableArchitecture in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DCBCB78324290F6D00DE1F59 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DCBCB76724290F6C00DE1F59 = { + isa = PBXGroup; + children = ( + DCF6E2CE24296752002F8A8F /* Frameworks */, + DCBCB77124290F6C00DE1F59 /* Products */, + DCBCB77224290F6C00DE1F59 /* Todos */, + DCBCB78924290F6D00DE1F59 /* TodosTests */, + ); + sourceTree = ""; + }; + DCBCB77124290F6C00DE1F59 /* Products */ = { + isa = PBXGroup; + children = ( + DCBCB77024290F6C00DE1F59 /* Todos.app */, + DCBCB78624290F6D00DE1F59 /* TodosTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + DCBCB77224290F6C00DE1F59 /* Todos */ = { + isa = PBXGroup; + children = ( + DCBCB78124290F6D00DE1F59 /* Info.plist */, + DCBCB77524290F6C00DE1F59 /* SceneDelegate.swift */, + CA93D05F249BF4D000A6F65D /* Todo.swift */, + DCBCB79A24290FEB00DE1F59 /* Todos.swift */, + DCBCB77924290F6D00DE1F59 /* Assets.xcassets */, + ); + path = Todos; + sourceTree = ""; + }; + DCBCB78924290F6D00DE1F59 /* TodosTests */ = { + isa = PBXGroup; + children = ( + DCBCB78A24290F6D00DE1F59 /* TodosTests.swift */, + ); + path = TodosTests; + sourceTree = ""; + }; + DCF6E2CE24296752002F8A8F /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DCBCB76F24290F6C00DE1F59 /* Todos */ = { + isa = PBXNativeTarget; + buildConfigurationList = DCBCB78F24290F6D00DE1F59 /* Build configuration list for PBXNativeTarget "Todos" */; + buildPhases = ( + DCBCB76C24290F6C00DE1F59 /* Sources */, + DCBCB76D24290F6C00DE1F59 /* Frameworks */, + DCBCB76E24290F6C00DE1F59 /* Resources */, + DCBCB79924290FDA00DE1F59 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Todos; + packageProductDependencies = ( + DC67272925FFAF6A00B47038 /* ComposableArchitecture */, + ); + productName = Todos; + productReference = DCBCB77024290F6C00DE1F59 /* Todos.app */; + productType = "com.apple.product-type.application"; + }; + DCBCB78524290F6D00DE1F59 /* TodosTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = DCBCB79224290F6D00DE1F59 /* Build configuration list for PBXNativeTarget "TodosTests" */; + buildPhases = ( + DCBCB78224290F6D00DE1F59 /* Sources */, + DCBCB78324290F6D00DE1F59 /* Frameworks */, + DCBCB78424290F6D00DE1F59 /* Resources */, + DCF6E2D124296752002F8A8F /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + DCBCB78824290F6D00DE1F59 /* PBXTargetDependency */, + ); + name = TodosTests; + packageProductDependencies = ( + ); + productName = TodosTests; + productReference = DCBCB78624290F6D00DE1F59 /* TodosTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DCBCB76824290F6C00DE1F59 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1140; + LastUpgradeCheck = 1240; + ORGANIZATIONNAME = "Point-Free"; + TargetAttributes = { + DCBCB76F24290F6C00DE1F59 = { + CreatedOnToolsVersion = 11.4; + }; + DCBCB78524290F6D00DE1F59 = { + CreatedOnToolsVersion = 11.4; + TestTargetID = DCBCB76F24290F6C00DE1F59; + }; + }; + }; + buildConfigurationList = DCBCB76B24290F6C00DE1F59 /* Build configuration list for PBXProject "Todos" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = DCBCB76724290F6C00DE1F59; + packageReferences = ( + DC67272625FFAF5600B47038 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */, + ); + productRefGroup = DCBCB77124290F6C00DE1F59 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DCBCB76F24290F6C00DE1F59 /* Todos */, + DCBCB78524290F6D00DE1F59 /* TodosTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + DCBCB76E24290F6C00DE1F59 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DCBCB77A24290F6D00DE1F59 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DCBCB78424290F6D00DE1F59 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + DCBCB76C24290F6C00DE1F59 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DCBCB77624290F6C00DE1F59 /* SceneDelegate.swift in Sources */, + CA93D060249BF4D000A6F65D /* Todo.swift in Sources */, + DCBCB79B24290FEB00DE1F59 /* Todos.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DCBCB78224290F6D00DE1F59 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DCBCB78B24290F6D00DE1F59 /* TodosTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + DCBCB78824290F6D00DE1F59 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DCBCB76F24290F6C00DE1F59 /* Todos */; + targetProxy = DCBCB78724290F6D00DE1F59 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + DCBCB78D24290F6D00DE1F59 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + DCBCB78E24290F6D00DE1F59 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + DCBCB79024290F6D00DE1F59 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = Todos/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.Todos; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + DCBCB79124290F6D00DE1F59 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = Todos/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.Todos; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + DCBCB79324290F6D00DE1F59 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.TodosTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Todos.app/Todos"; + }; + name = Debug; + }; + DCBCB79424290F6D00DE1F59 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.TodosTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Todos.app/Todos"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DCBCB76B24290F6C00DE1F59 /* Build configuration list for PBXProject "Todos" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DCBCB78D24290F6D00DE1F59 /* Debug */, + DCBCB78E24290F6D00DE1F59 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DCBCB78F24290F6D00DE1F59 /* Build configuration list for PBXNativeTarget "Todos" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DCBCB79024290F6D00DE1F59 /* Debug */, + DCBCB79124290F6D00DE1F59 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DCBCB79224290F6D00DE1F59 /* Build configuration list for PBXNativeTarget "TodosTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DCBCB79324290F6D00DE1F59 /* Debug */, + DCBCB79424290F6D00DE1F59 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + DC67272625FFAF5600B47038 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture"; + requirement = { + kind = exactVersion; + version = 0.16.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + DC67272925FFAF6A00B47038 /* ComposableArchitecture */ = { + isa = XCSwiftPackageProductDependency; + package = DC67272625FFAF5600B47038 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */; + productName = ComposableArchitecture; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = DCBCB76824290F6C00DE1F59 /* Project object */; +} diff --git a/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/xcshareddata/xcschemes/Todos.xcscheme b/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/xcshareddata/xcschemes/Todos.xcscheme new file mode 100644 index 00000000..795eb3fe --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos.xcodeproj/xcshareddata/xcschemes/Todos.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/AppIcon.appiconset/AppIcon.png b/0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/AppIcon.appiconset/AppIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..186b90e3fe4c070ff0bbef31ad85baa47a055d38 GIT binary patch literal 8152 zcmXAu2T&8=6URYX=pZ!;gd$Bkks=DAS3v}%iZl(qh*W_DL3&jXqy_~=dItd^^cq3B z^b+YU2uOgC{NwL`Gj})h?!Ddp?%TV$*-xCYkq$l04H^;>5_&ydO%vk1{@)3>M!eQm zy?stXLh9hEp<(Q+t&_dIiJrK~fP;g*{lE_~ zQ5xSsli1iq6MOhT2g951bdGd1af7`S$)uzzs)BUVH`qd3`#J!hq;?}vN`i6?dJRuI zW*om@rV^?&bEKyVNh;GP*PiiSQN^03(Z=g@a&nr6d#wL?ca5o)Y=B+#ni9=GKAB^& z#;=>Id$$0W082yNRB&n-*?_t3h%R|{CzfnrT2KA@LmfwreF{>qOw?LLZjXKxiPN=8 zL9+BB^Yn0+O0bu~;^Fn?!wifvI!QI}$vtMr8|-v+5esy5!U62J*aah^KD_=QDv|Vhb;6gDa!Hqx za+Ow9d92s9Puo6Nn@5KR{T_q<5h=rrQKXPDa)XizKub~5Rm?pyv~-T0=L zK?gP{@zK?T{Jcdt)Hy}d;jAI^xCUIj+c z>JQk_JU^QlL5NeRA|z)eGx^`5p^Q%29ljgD>eiixp~An-knA#SMXZt-fb6-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<-mB{K=M{L-aaqsEFP!AkU) zsV3vU$uC`cX*>%07i^!AJkL@bkQ5y5Q5&Ma^^XYzf~=Wsd?Pc?=xS@9fa^_VQ{)UW zwExDR9NkSHRPr5l-{(aS#2*l2A&zoC>CI!-e^L9ewH@WqrS%e)c(lEIo;A26hVXB0y(Id*+G95P{ zol+D8?n93C=$&AN_vnGohC~*oJ-{p;yY|ath24E&G3Gk%ItG1jX&E5;7De~HnpH{w z+imrcQmCCoFrNkY3G3;rIy1pkIAGJB+muUMwgru_Q^C(K&jZTxN1IpxqK&sDTBu6# zh!u{W6mNJHt8xp6o{yGpVLDsh1I*=`@bA>zA6-vxMoD4R{M+vm`6fs2zj@+nmapqA zzOPCC+X%iGK{JE+nfku4heYd*Qf)RFKQpd(^cW?l{YTxl7ir#w4(^1D>6{1>6H9=| YhpMf=!oN%>5_=LoEhEiJb^D0_0Whjby#N3J literal 0 HcmV?d00001 diff --git a/0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/AppIcon.appiconset/Contents.json b/0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..e4b96da0 --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,99 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "AppIcon.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/Contents.json b/0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0138-better-test-dependencies-pt1/Todos/Todos/Info.plist b/0138-better-test-dependencies-pt1/Todos/Todos/Info.plist new file mode 100644 index 00000000..9742bf0f --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos/Info.plist @@ -0,0 +1,60 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/0138-better-test-dependencies-pt1/Todos/Todos/SceneDelegate.swift b/0138-better-test-dependencies-pt1/Todos/Todos/SceneDelegate.swift new file mode 100644 index 00000000..8dc79320 --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos/SceneDelegate.swift @@ -0,0 +1,40 @@ +import ComposableArchitecture +import SwiftUI +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + var window: UIWindow? + + func scene( + _ scene: UIScene, + willConnectTo session: UISceneSession, + options connectionOptions: UIScene.ConnectionOptions + ) { + self.window = (scene as? UIWindowScene).map(UIWindow.init(windowScene:)) + + let rootView = AppView( + store: Store( + initialState: AppState(), + reducer: appReducer, + environment: AppEnvironment( + analytics: .live, + mainQueue: DispatchQueue.main.eraseToAnyScheduler(), + uuid: UUID.init + ) + ) + ) + + self.window?.rootViewController = UIHostingController(rootView: rootView) + self.window?.makeKeyAndVisible() + } +} + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + true + } +} diff --git a/0138-better-test-dependencies-pt1/Todos/Todos/Todo.swift b/0138-better-test-dependencies-pt1/Todos/Todos/Todo.swift new file mode 100644 index 00000000..59079953 --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos/Todo.swift @@ -0,0 +1,49 @@ +import ComposableArchitecture +import Foundation +import SwiftUI + +struct Todo: Equatable, Identifiable { + var description = "" + let id: UUID + var isComplete = false +} + +enum TodoAction: Equatable { + case checkBoxToggled + case textFieldChanged(String) +} + +struct TodoEnvironment {} + +let todoReducer = Reducer { todo, action, _ in + switch action { + case .checkBoxToggled: + todo.isComplete.toggle() + return .none + + case let .textFieldChanged(description): + todo.description = description + return .none + } +} + +struct TodoView: View { + let store: Store + + var body: some View { + WithViewStore(self.store) { viewStore in + HStack { + Button(action: { viewStore.send(.checkBoxToggled) }) { + Image(systemName: viewStore.isComplete ? "checkmark.square" : "square") + } + .buttonStyle(PlainButtonStyle()) + + TextField( + "Untitled Todo", + text: viewStore.binding(get: { $0.description }, send: TodoAction.textFieldChanged) + ) + } + .foregroundColor(viewStore.isComplete ? .gray : nil) + } + } +} diff --git a/0138-better-test-dependencies-pt1/Todos/Todos/Todos.swift b/0138-better-test-dependencies-pt1/Todos/Todos/Todos.swift new file mode 100644 index 00000000..2e6401f6 --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/Todos/Todos.swift @@ -0,0 +1,230 @@ +import ComposableArchitecture +import SwiftUI + +enum Filter: LocalizedStringKey, CaseIterable, Hashable { + case all = "All" + case active = "Active" + case completed = "Completed" +} + +struct AppState: Equatable { + var editMode: EditMode = .inactive + var filter: Filter = .all + var todos: IdentifiedArrayOf = [] + + var filteredTodos: IdentifiedArrayOf { + switch filter { + case .active: return self.todos.filter { !$0.isComplete } + case .all: return self.todos + case .completed: return self.todos.filter { $0.isComplete } + } + } +} + +enum AppAction: Equatable { + case addTodoButtonTapped + case clearCompletedButtonTapped + case delete(IndexSet) + case editModeChanged(EditMode) + case filterPicked(Filter) + case move(IndexSet, Int) + case sortCompletedTodos + case todo(id: UUID, action: TodoAction) +} + +struct AppEnvironment { + var analytics: AnalyticsClient + var mainQueue: AnySchedulerOf + var uuid: () -> UUID +} + +let appReducer = Reducer.combine( + todoReducer.forEach( + state: \.todos, + action: /AppAction.todo(id:action:), + environment: { _ in TodoEnvironment() } + ), + Reducer { state, action, environment in + switch action { + case .addTodoButtonTapped: + state.todos.insert(Todo(id: environment.uuid()), at: 0) + return .none + + case .clearCompletedButtonTapped: + state.todos.removeAll(where: { $0.isComplete }) + return environment.analytics.track(.init(name: "Cleared Completed Todos")) + .fireAndForget() + + case let .delete(indexSet): + state.todos.remove(atOffsets: indexSet) + return environment.analytics.track( + .init( + name: "Todo Deleted", + properties: ["editMode": "\(state.editMode)"] + ) + ) + .fireAndForget() + + case let .editModeChanged(editMode): + state.editMode = editMode + return .none + + case let .filterPicked(filter): + state.filter = filter + return .none + + case let .move(source, destination): + state.todos.move(fromOffsets: source, toOffset: destination) + return Effect(value: .sortCompletedTodos) + .delay(for: .milliseconds(100), scheduler: environment.mainQueue) + .eraseToEffect() + + case .sortCompletedTodos: + state.todos.sortCompleted() + return .none + + case .todo(id: _, action: .checkBoxToggled): + struct TodoCompletionId: Hashable {} + return Effect(value: .sortCompletedTodos) + .debounce(id: TodoCompletionId(), for: 1, scheduler: environment.mainQueue.animation()) + + case .todo: + return .none + } + } +) + +struct AppView: View { + struct ViewState: Equatable { + var editMode: EditMode + var isClearCompletedButtonDisabled: Bool + } + + let store: Store + + var body: some View { + WithViewStore(self.store.scope(state: { $0.view })) { viewStore in + NavigationView { + VStack(alignment: .leading) { + WithViewStore(self.store.scope(state: { $0.filter }, action: AppAction.filterPicked)) { + filterViewStore in + Picker( + "Filter", selection: filterViewStore.binding(send: { $0 }).animation() + ) { + ForEach(Filter.allCases, id: \.self) { filter in + Text(filter.rawValue).tag(filter) + } + } + .pickerStyle(SegmentedPickerStyle()) + } + .padding([.leading, .trailing]) + + List { + ForEachStore( + self.store.scope(state: { $0.filteredTodos }, action: AppAction.todo(id:action:)), + content: TodoView.init(store:) + ) + .onDelete { viewStore.send(.delete($0)) } + .onMove { viewStore.send(.move($0, $1)) } + } + } + .navigationBarTitle("Todos") + .navigationBarItems( + trailing: HStack(spacing: 20) { + EditButton() + Button("Clear Completed") { + viewStore.send(.clearCompletedButtonTapped, animation: .default) + } + .disabled(viewStore.isClearCompletedButtonDisabled) + Button("Add Todo") { viewStore.send(.addTodoButtonTapped, animation: .default) } + } + ) + .environment( + \.editMode, + viewStore.binding(get: { $0.editMode }, send: AppAction.editModeChanged) + ) + } + .navigationViewStyle(StackNavigationViewStyle()) + } + } +} + +extension AppState { + var view: AppView.ViewState { + .init( + editMode: self.editMode, + isClearCompletedButtonDisabled: !self.todos.contains(where: { $0.isComplete }) + ) + } +} + +extension IdentifiedArray where ID == UUID, Element == Todo { + fileprivate mutating func sortCompleted() { + // Simulate stable sort + self = IdentifiedArray( + self.enumerated() + .sorted(by: { lhs, rhs in + (rhs.element.isComplete && !lhs.element.isComplete) || lhs.offset < rhs.offset + }) + .map { $0.element } + ) + } +} + +extension IdentifiedArray where ID == UUID, Element == Todo { + static let mock: Self = [ + Todo( + description: "Check Mail", + id: UUID(uuidString: "DEADBEEF-DEAD-BEEF-DEAD-BEEDDEADBEEF")!, + isComplete: false + ), + Todo( + description: "Buy Milk", + id: UUID(uuidString: "CAFEBEEF-CAFE-BEEF-CAFE-BEEFCAFEBEEF")!, + isComplete: false + ), + Todo( + description: "Call Mom", + id: UUID(uuidString: "D00DCAFE-D00D-CAFE-D00D-CAFED00DCAFE")!, + isComplete: true + ), + ] +} + +struct AppView_Previews: PreviewProvider { + static var previews: some View { + AppView( + store: Store( + initialState: AppState(todos: .mock), + reducer: appReducer, + environment: AppEnvironment( + analytics: .live, + mainQueue: DispatchQueue.main.eraseToAnyScheduler(), + uuid: UUID.init + ) + ) + ) + } +} + +struct AnalyticsClient { + let track: (Event) -> Effect + + struct Event: Equatable { + var name: String + var properties: [String: String] = [:] + } +} + +extension AnalyticsClient { + static let live = Self( + track: { event in + .fireAndForget { + print("Track name: \(event.name), properties: \(event.properties)") + // TODO: send the event data to the analytics server +// URLSession.shared.dataTask(with: URL(string: "https://www.my-company.com/analytics")!) +// .resume() + } + } + ) +} diff --git a/0138-better-test-dependencies-pt1/Todos/TodosTests/TodosTests.swift b/0138-better-test-dependencies-pt1/Todos/TodosTests/TodosTests.swift new file mode 100644 index 00000000..463f9bd4 --- /dev/null +++ b/0138-better-test-dependencies-pt1/Todos/TodosTests/TodosTests.swift @@ -0,0 +1,373 @@ +import ComposableArchitecture +import XCTest + +@testable import Todos + +class TodosTests: XCTestCase { + var events: [AnalyticsClient.Event] = [] + let scheduler = DispatchQueue.testScheduler + + func testAddTodo() { + let store = TestStore( + initialState: AppState(), + reducer: appReducer, + environment: AppEnvironment( + analytics: .unimplemented, + mainQueue: .unimplemented, + uuid: UUID.incrementing + ) + ) + + store.assert( + .send(.addTodoButtonTapped) { + $0.todos.insert( + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000000")!, + isComplete: false + ), + at: 0 + ) + }, + .send(.addTodoButtonTapped) { + $0.todos.insert( + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000001")!, + isComplete: false + ), + at: 0 + ) + } + ) + } + + func testEditTodo() { + let state = AppState( + todos: [ + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000000")!, + isComplete: false + ) + ] + ) + let store = TestStore( + initialState: state, + reducer: appReducer, + environment: AppEnvironment( + analytics: .unimplemented, + mainQueue: .unimplemented, + uuid: UUID.unimplemented + ) + ) + + store.assert( + .send( + .todo(id: state.todos[0].id, action: .textFieldChanged("Learn Composable Architecture")) + ) { + $0.todos[0].description = "Learn Composable Architecture" + } + ) + } + + func testCompleteTodo() { + let state = AppState( + todos: [ + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000000")!, + isComplete: false + ), + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000001")!, + isComplete: false + ), + ] + ) + let store = TestStore( + initialState: state, + reducer: appReducer, + environment: AppEnvironment( + analytics: .unimplemented, + mainQueue: self.scheduler.eraseToAnyScheduler(), + uuid: UUID.unimplemented + ) + ) + + store.assert( + .send(.todo(id: state.todos[0].id, action: .checkBoxToggled)) { + $0.todos[0].isComplete = true + }, + .do { self.scheduler.advance(by: 1) }, + .receive(.sortCompletedTodos) { + $0.todos = [ + $0.todos[1], + $0.todos[0], + ] + } + ) + } + + func testCompleteTodoDebounces() { + let state = AppState( + todos: [ + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000000")!, + isComplete: false + ), + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000001")!, + isComplete: false + ), + ] + ) + let store = TestStore( + initialState: state, + reducer: appReducer, + environment: AppEnvironment( + analytics: .unimplemented, + mainQueue: self.scheduler.eraseToAnyScheduler(), + uuid: UUID.incrementing + ) + ) + + store.assert( + .send(.todo(id: state.todos[0].id, action: .checkBoxToggled)) { + $0.todos[0].isComplete = true + }, + .do { self.scheduler.advance(by: 0.5) }, + .send(.todo(id: state.todos[0].id, action: .checkBoxToggled)) { + $0.todos[0].isComplete = false + }, + .do { self.scheduler.advance(by: 1) }, + .receive(.sortCompletedTodos) + ) + } + + func testClearCompleted() { + let state = AppState( + todos: [ + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000000")!, + isComplete: false + ), + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000001")!, + isComplete: true + ), + ] + ) + let store = TestStore( + initialState: state, + reducer: appReducer, + environment: AppEnvironment( + analytics: .test(onEvent: { event in self.events.append(event) }), + mainQueue: self.scheduler.eraseToAnyScheduler(), + uuid: UUID.incrementing + ) + ) + + store.assert( + .send(.clearCompletedButtonTapped) { + $0.todos = [ + $0.todos[0] + ] + } + ) + XCTAssertEqual(events, [.init(name: "Cleared Completed Todos")]) + } + + func testDelete() { + let state = AppState( + todos: [ + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000000")!, + isComplete: false + ), + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000001")!, + isComplete: false + ), + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000002")!, + isComplete: false + ), + ] + ) + let store = TestStore( + initialState: state, + reducer: appReducer, + environment: AppEnvironment( + analytics: .test { self.events.append($0) }, + mainQueue: .unimplemented, + uuid: UUID.unimplemented + ) + ) + + store.assert( + .send(.delete([1])) { + $0.todos = [ + $0.todos[0], + $0.todos[2], + ] + }, + .do { + XCTAssertEqual( + self.events, + [ + .init(name: "Todo Deleted", properties: ["editMode": "inactive"]), + ] + ) + + }, + .send(.editModeChanged(.active)) { + $0.editMode = .active + }, + .send(.delete([0])) { + $0.todos = [ + $0.todos[1] + ] + } + ) + XCTAssertEqual( + events, + [ + .init(name: "Todo Deleted", properties: ["editMode": "inactive"]), + .init(name: "Todo Deleted", properties: ["editMode": "active"]), + ] + ) + } + + func testEditModeMoving() { + let state = AppState( + todos: [ + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000000")!, + isComplete: false + ), + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000001")!, + isComplete: false + ), + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000002")!, + isComplete: false + ), + ] + ) + let store = TestStore( + initialState: state, + reducer: appReducer, + environment: AppEnvironment( + analytics: .unimplemented, + mainQueue: self.scheduler.eraseToAnyScheduler(), + uuid: UUID.incrementing + ) + ) + + store.assert( + .send(.editModeChanged(.active)) { + $0.editMode = .active + }, + .send(.move([0], 2)) { + $0.todos = [ + $0.todos[1], + $0.todos[0], + $0.todos[2], + ] + }, + .do { self.scheduler.advance(by: .milliseconds(100)) }, + .receive(.sortCompletedTodos) + ) + } + + func testFilteredEdit() { + let state = AppState( + todos: [ + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000000")!, + isComplete: false + ), + Todo( + description: "", + id: UUID(uuidString: "00000000-0000-0000-0000-000000000001")!, + isComplete: true + ), + ] + ) + let store = TestStore( + initialState: state, + reducer: appReducer, + environment: AppEnvironment( + analytics: .unimplemented, + mainQueue: self.scheduler.eraseToAnyScheduler(), + uuid: UUID.incrementing + ) + ) + + store.assert( + .send(.filterPicked(.completed)) { + $0.filter = .completed + }, + .send(.todo(id: state.todos[1].id, action: .textFieldChanged("Did this already"))) { + $0.todos[1].description = "Did this already" + } + ) + } +} + +extension UUID { + // A deterministic, auto-incrementing "UUID" generator for testing. + static var incrementing: () -> UUID { + var uuid = 0 + return { + defer { uuid += 1 } + return UUID(uuidString: "00000000-0000-0000-0000-\(String(format: "%012x", uuid))")! + } + } + + static let unimplemented: () -> UUID = { fatalError() } +} + +import Combine + +extension Scheduler { + static var unimplemented: AnySchedulerOf { + AnyScheduler( + minimumTolerance: { fatalError() }, + now: { fatalError() }, + scheduleImmediately: { _, _ in fatalError() }, + delayed: { _, _, _, _ in fatalError() }, + interval: { _, _, _, _, _ in fatalError() } + ) + } +} + +extension AnalyticsClient { + static let unimplemented = Self( + track: { _ in fatalError() } + ) + + static func test(onEvent: @escaping (Event) -> Void) -> Self { + Self( + track: { event in + .fireAndForget { + onEvent(event) + } + } + ) + } +} diff --git a/README.md b/README.md index 824792e9..e21b7452 100644 --- a/README.md +++ b/README.md @@ -139,3 +139,4 @@ This repository is the home of code written on episodes of [Point-Free](https:// 1. [SwiftUI Animation: The Basics](0135-swiftui-animation-pt1) 1. [SwiftUI Animation: Composable Architecture](0136-swiftui-animation-pt2) 1. [SwiftUI Animation: The Point](0137-swiftui-animation-pt3) +1. [Better Test Dependencies: Exhaustivity](0138-better-test-dependencies-pt1)