🎉 End-of-year Sale! Save 25% when you subscribe today.

Shared State: Testing, Part 2

Episode #272 • Mar 25, 2024 • Subscriber-Only

We will employ @Shared’s new testing capabilities in a complex scenario: a sign up flow. We will see how a deeply nested integration of features all sharing the same state can be tested simply, and we will see how we can leverage the same tricks employed by the test store to add debug tools to reducers using shared state.

Collection
Sharing and Persisting State
Shared State: Testing, Part 2
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

Stephen

So, it may not seem like it, but what we have accomplished is actually quite amazing. We are writing tests for features that contain a reference type as if they are just regular features built on value types. We are exhaustively testing every aspect of the feature, while at the same time being able to share a piece of state with multiple features. This means we have all of the ergonomics and powers of reference types, with seemingly none of the down sides.

Brandon

But so far the tests we have been dealing with have been quite simple. Let’s see a more real world and advanced example. In fact, the sign up flow we built the previous episode would be a great testing ground for this. That was dealing with state shared amongst many features, and if we can simple tests for that, then we would know we have achieved something pretty amazing.

Let’s take a look.

Testing the sign up flow


Downloads

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 64 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing