-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
188 changed files
with
19,246 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#--- | ||
#--- Rules | ||
|
||
# Find all the available rules by running: | ||
# swiftlint rules | ||
|
||
disabled_rules: # rule identifiers to exclude from running | ||
- identifier_name | ||
- line_length | ||
- no_extension_access_modifier | ||
- statement_position | ||
- shorthand_operator | ||
|
||
opt_in_rules: # some rules are only opt-in | ||
- anyobject_protocol | ||
- collection_alignment | ||
- closure_spacing | ||
- closure_parameter_position | ||
- colon | ||
- comma | ||
- compiler_protocol_init | ||
- contains_over_filter_count | ||
- contains_over_filter_is_empty | ||
- contains_over_first_not_nil | ||
- control_statement | ||
- convenience_type | ||
- deployment_target | ||
- discarded_notification_center_observer | ||
- duplicate_enum_cases | ||
- duplicate_imports | ||
- empty_count | ||
- empty_enum_arguments | ||
- empty_string | ||
- empty_xctest_method | ||
- explicit_init | ||
- force_cast | ||
- force_try | ||
- force_unwrapping | ||
- inert_defer | ||
- last_where | ||
- legacy_multiple | ||
- legacy_random | ||
- multiline_arguments | ||
- multiline_function_chains | ||
- multiline_parameters | ||
- no_space_in_method_call | ||
- opening_brace | ||
- operator_usage_whitespace | ||
- overridden_super_call | ||
- prohibited_super_call | ||
- redundant_discardable_let | ||
- redundant_nil_coalescing | ||
- redundant_optional_initialization | ||
- redundant_string_enum_value | ||
- return_arrow_whitespace | ||
- static_operator | ||
- superfluous_disable_command | ||
- toggle_bool | ||
- trailing_comma | ||
- trailing_newline | ||
- trailing_semicolon | ||
- trailing_whitespace | ||
- unused_declaration | ||
- vertical_parameter_alignment_on_call | ||
- yoda_condition | ||
|
||
custom_rules: | ||
no_space_after_opening_parentheses: | ||
name: "No space after opening parentheses" | ||
message: "Please avoid using space after opening parentheses" | ||
regex: '\(\h+' | ||
|
||
anonymous_init: | ||
name: "Anonymous init()" | ||
message: "Prefer explicit type initializer over anonymous calls to init()" | ||
regex: '(\h+|\()\.init\(' | ||
|
||
#--- | ||
#--- Rule configuration | ||
|
||
# configurable rules can be customized from this configuration file | ||
# binary rules can set their severity level | ||
# rules that have both warning and error levels, can set just the warning level | ||
# or they can set both explicitly | ||
|
||
cyclomatic_complexity: | ||
warning: 10 | ||
error: 20 | ||
ignores_case_statements: true | ||
|
||
file_length: | ||
warning: 450 | ||
|
||
force_cast: warning | ||
force_try: warning | ||
force_unwrapping: warning | ||
|
||
function_body_length: | ||
warning: 50 # default is 40 | ||
error: 120 # default is 100 | ||
|
||
function_parameter_count: | ||
warning: 6 | ||
error: 9 | ||
|
||
large_tuple: | ||
warning: 3 | ||
error: 4 | ||
|
||
nesting: | ||
type_level: | ||
warning: 3 # default is 1 | ||
|
||
trailing_whitespace: | ||
ignores_empty_lines: true | ||
|
||
type_body_length: | ||
warning: 500 # default is 200 | ||
error: 1000 # default is 350 | ||
|
||
type_name: | ||
max_length: 60 | ||
|
||
unused_setter_value: error | ||
|
||
|
||
#--- | ||
#--- Paths | ||
|
||
#included: # paths to include during linting. `--path` is ignored if present. | ||
# - ../Pod | ||
# In ios-common-config, the path to the sources will be done via the --path argument | ||
|
||
excluded: # paths to ignore during linting. Takes precedence over `included`. | ||
- ./Example/Pods | ||
- ./Pods | ||
- ./vendor | ||
- ./fastlane | ||
|
||
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji) |
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,68 @@ | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// CounterStoreTests.swift | ||
// | ||
// Created by Steven Grosmark on 10/5/19. | ||
// | ||
// | ||
// This source file is part of the Lasso open source project | ||
// | ||
// https://github.com/ww-tech/lasso | ||
// | ||
// Copyright © 2019-2020 WW International, Inc. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
|
||
import XCTest | ||
import LassoTestUtilities | ||
@testable import Lasso_Example | ||
|
||
class CounterStoreTests: XCTestCase, LassoStoreTestCase { | ||
|
||
let testableStore = TestableStore<CounterStore>() | ||
|
||
override func setUp() { | ||
super.setUp() | ||
store = CounterStore() | ||
XCTAssertEqual(store.state.counter, 0) | ||
} | ||
|
||
func test_IncrementDecrement() { | ||
// when - tap + 3x | ||
for _ in 0..<3 { | ||
store.dispatchAction(.didTapIncrement) | ||
} | ||
|
||
// then - counter should be 3 | ||
XCTAssertStateEquals(updatedMarker { state in | ||
state.counter = 3 | ||
}) | ||
|
||
// when - tap decrement | ||
store.dispatchAction(.didTapDecrement) | ||
|
||
// then - counter should go down | ||
XCTAssertStateEquals(updatedMarker { state in | ||
state.counter = 2 | ||
}) | ||
|
||
// sanity check no outputs generated | ||
XCTAssertOutputs([]) | ||
} | ||
|
||
func test_Decrement_Clamping() { | ||
// when | ||
store.dispatchAction(.didTapDecrement) | ||
|
||
// then - don't go negative | ||
XCTAssertEqual(store.state.counter, 0) | ||
} | ||
|
||
func test_Next() { | ||
store.dispatchAction(.didTapNext) | ||
XCTAssertOutputs([.didTapNext]) | ||
} | ||
|
||
} |
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,75 @@ | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// FoodOnboardingTests.swift | ||
// | ||
// Created by Trevor Beasty on 7/16/19. | ||
// | ||
// | ||
// This source file is part of the Lasso open source project | ||
// | ||
// https://github.com/ww-tech/lasso | ||
// | ||
// Copyright © 2019-2020 WW International, Inc. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
|
||
import XCTest | ||
import Lasso | ||
import LassoTestUtilities | ||
@testable import Lasso_Example | ||
|
||
class FoodOnboardingTests: FlowTestCase { | ||
|
||
var flow: FoodOnboardingFlow! | ||
|
||
override func setUp() { | ||
super.setUp() | ||
flow = FoodOnboardingFlow() | ||
} | ||
|
||
override func tearDown() { | ||
flow = nil | ||
super.tearDown() | ||
} | ||
|
||
func test() throws { | ||
typealias State = TextScreenModule.State | ||
|
||
// flow start | ||
let welcomeController: TextViewController = try assertRoot( | ||
of: navigationController, | ||
when: { flow.start(with: root(of: navigationController)) } | ||
) | ||
|
||
XCTAssertEqual(welcomeController.store.state, State(title: "Welcome", | ||
description: "We just need a little info to get you going...", | ||
buttons: ["Next"])) | ||
|
||
// press next on welcome screen | ||
let notificationsController: TextViewController = try assertPushed( | ||
after: welcomeController, | ||
when: { welcomeController.store.dispatchAction(.didTapButton(0)) } | ||
) | ||
|
||
XCTAssertEqual(notificationsController.store.state, State(title: "Notifications", | ||
description: "Enable Notifications for the smoothest experience...", | ||
buttons: ["Next"])) | ||
|
||
// press next on notifications screen | ||
let finishController: TextViewController = try assertPushed( | ||
after: notificationsController, | ||
when: { notificationsController.store.dispatchAction(.didTapButton(0)) } | ||
) | ||
|
||
XCTAssertEqual(finishController.store.state, State(title: "All set", | ||
description: "Ok, let's get started!", | ||
buttons: ["Finish"])) | ||
|
||
// output | ||
flow.assert(when: { finishController.store.dispatchAction(.didTapButton(0)) }, | ||
outputs: .didFinish) | ||
} | ||
|
||
} |
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,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
Oops, something went wrong.