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

microstates / trafficlight / 39 / 1
99%
master: 99%

Build:
Build:
LAST BUILD BRANCH: tm/add-chat-badge
DEFAULT BRANCH: master
Ran 10 Jan 2019 07:54PM UTC
Files 8
Run time 14s
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

10 Jan 2019 07:42PM UTC coverage: 98.969% (-0.07%) from 99.038%
39.1

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

Source Files on job 39.1
  • Tree
  • List 0
  • Changed 4
  • Source Changed 4
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 7
  • Travis Job 39.1
  • 7167c312 on github
  • Prev Job for on cl/union-types (#37.1)
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