Let's write and test a State Machine with this awesome Developer Experience combo: XState + TypeScript + Vitest 🚀
XState is *the* library for orchestrating complex application states, regardless of framework (it's compatible with all of them, actually). In this video we will have a look on writing our first State Machine with XState, as well as checking a few concepts for State-Machines.
1:05 Setup repository
2:08 State-Machine concepts
6:09 writing some types manually
8:33 Vitest suite setup
12:30 create State-Machine with XState
13:40 XState VSCode Extension
19:49 Stately Inspector (XState VSCode)
26:55 Testing the State-Machine happy path
32:15 Why you should reset your mock counters after each test
35:41 Mock XState context on tests
37:19 Asynchronous test, wait on State transition
39:46 Test error boundaries in your State-Machine
🔗
Matt Pocock's playlist: • React & XState Tutoria...
XState VSCode Extension: marketplace.vi...
Vitest docs: vitest.dev/
XState docs: xstate.js.org/...
XState Viz: stately.ai/viz
16 окт 2024