Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cc6bc8f
[Test] Add FrogcjnTest (event + associated value).
inamiy Nov 1, 2015
ef07416
Refactor code for better typing, naming, and routeMapping support.
inamiy Nov 14, 2015
465146a
[Test] Remove unnecessary `case Any`.
inamiy Nov 14, 2015
da9b9b4
Remove unnecessary methods.
inamiy Nov 24, 2015
c9f6db9
Add comment.
inamiy Nov 24, 2015
32630e2
Rename `Mapping` to `RouteMapping`.
inamiy Nov 24, 2015
93f184b
[Test] Organize tests.
inamiy Nov 24, 2015
bfd9ed2
Remove verbose methods in `Transition` & `Route`.
inamiy Nov 24, 2015
439d5a8
Organize code.
inamiy Nov 28, 2015
12cb3b8
[Test] Add testHasRoute_anyEvent()
inamiy Nov 28, 2015
2eeff1f
Add `final` modifiers.
inamiy Nov 28, 2015
1be6782
[Test] Re-add HierarchicalMachineTests which was deleted in ef07416.
inamiy Nov 29, 2015
8e093da
Update README.md & BasicTests.
inamiy Nov 30, 2015
2986012
Resize logo.png
inamiy Nov 30, 2015
f7ce748
Refactor code by separating event-only-driven `Machine` and `StateMac…
inamiy Dec 5, 2015
8ade68e
[Test] Add more RouteMapping tests.
inamiy Dec 5, 2015
e9c1bf3
[Test] Improve 8ade68e & update README.md
inamiy Dec 5, 2015
c1c18ec
Add `addStateRouteMapping()` & rename `EventRouteMapping` to `RouteMa…
inamiy Dec 7, 2015
b42ac6d
Update README.md
inamiy Dec 7, 2015
4c15f86
Conform State<S> & Event<E> to RawRepresentable.
inamiy Dec 8, 2015
edc0f3e
Set codeCoverageEnabled=YES.
inamiy Dec 8, 2015
2c9844f
[Test] Add StateTests & EventTests.
inamiy Dec 8, 2015
ce2ef2a
Fix RouteMapping + handler.
inamiy Dec 8, 2015
56b8c76
Simplify `machine.addRoutes()`.
inamiy Dec 8, 2015
e49b1c6
[Test] Improve code coverage.
inamiy Dec 8, 2015
c1751bf
Create universal framework to support watchOS & tvOS by using xcconfigs.
inamiy Dec 8, 2015
c6b59e4
Merge pull request #38 from ReactKit/universal-framework
inamiy Dec 8, 2015
83af536
Remove unnecessary xcodeproj settings.
inamiy Dec 9, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Test] Add testHasRoute_anyEvent()
  • Loading branch information
inamiy committed Nov 28, 2015
commit 12cb3b89a1435970d9c2bda30ea20e05c5769a12
28 changes: 27 additions & 1 deletion SwiftStateTests/TryEventTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class TryEventTests: _TestCase

// Fix for transitioning of routes w/ multiple from-states
// https://github.com/ReactKit/SwiftState/pull/32
func testTryEvent_issue32() {
func testTryEvent_issue32()
{
let machine = Machine<MyState, MyEvent>(state: .State0) { machine in
machine.addRouteEvent(.Event0, transitions: [ .State0 => .State1 ])
machine.addRouteEvent(.Event1, routes: [ [ .State1, .State2 ] => .State3 ])
Expand All @@ -131,6 +132,31 @@ class TryEventTests: _TestCase
XCTAssertEqual(machine.state, MyState.State3)
}

// MARK: hasRoute + event

func testHasRoute_anyEvent()
{
({
let machine = Machine<MyState, MyEvent>(state: .State0) { machine in
machine.addRoute(.State0 => .State1)
machine.addRouteEvent(.Any, transitions: [.State0 => .State1])
}

let hasRoute = machine.hasRoute(.State0 => .State1, forEvent: .Event0)
XCTAssertTrue(hasRoute)
})()

({
let machine = Machine<MyState, MyEvent>(state: .State0) { machine in
machine.addRoute(.State0 => .State1)
machine.addRouteEvent(.Any, transitions: [.State2 => .State3])
}

let hasRoute = machine.hasRoute(.State0 => .State1, forEvent: .Event0)
XCTAssertFalse(hasRoute)
})()
}

// Fix hasRoute() bug when there are routes for no-event & with-event.
// https://github.com/ReactKit/SwiftState/pull/19
func testHasRoute_issue19()
Expand Down