• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

microstates / trafficlight / 39
99%
master: 99%

Build:
Build:
LAST BUILD BRANCH: tm/add-chat-badge
DEFAULT BRANCH: master
Ran 10 Jan 2019 07:54PM UTC
Jobs 1
Files 8
Run time 36s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
39

push

travis-ci-com

cowboyd
Add ability to transition type.

One of the key features about using a Union type to represent a state
machine is that you must have a convenient way to transition from one
type to the next.

Previously, we were doing it by adding by returning a freshly minted
state:

```javascript

change() {
  return Color.Red.create();
}
```

This works, but is only quasi-microstate-y. Really, the microstate way
would be to provide a transition method.

This commit does just that. Instead of returning a new instance of
microstate, they `type` parameter is now smart, and hase a transition
method to every other possible member (or State) of the union type. So
the above code can be re-written:

```javascript
change() {
  return this.type.toRed();
}
```

29 of 30 branches covered (96.67%)

Branch coverage included in aggregate %.

67 of 67 relevant lines covered (100.0%)

175.34 hits per line

Jobs
ID Job ID Ran Files Coverage
1 39.1 10 Jan 2019 07:54PM UTC 0
98.97
Travis Job 39.1
Source Files on build 39
Detailed source file information is not available for this build.
  • Back to Repo
  • Build #39
  • 7167c312 on github
  • Prev Build on cl/union-types (#37)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc