mobxjs / mobx-state-tree

Full-featured reactive state management without the boilerplate
https://mobx-state-tree.js.org/
MIT License
6.9k stars 640 forks source link

test: add tests for string primitive #2121

Closed coolsoftwaretyler closed 7 months ago

coolsoftwaretyler commented 7 months ago

What does this PR do and why?

I've been working on really deeply understanding what's going on with the MST internals, and I wanted to get a feel for the code under my finger. I recognize some of these tests are duplicative, since we implicitly test this behavior elsewhere, but I wanted to try and isolate public methods and properties from types.string, and an isolated instance of it.

These tests also test the internals, which I know can be an anti-pattern, but in our case where the maintainer team is made up of people who have not written the code from scratch, I think some tight coupling on the tests here will provide us with better coverage when we make changes, and help avoid breaking things. We may get some false negatives in the course of development, but that's a tradeoff I'm happy to make for improved stability, and for my own learning.

I also updated our yarn jest command to stop overriding jest with a hardcoded path. yarn jest still works, but you can also actually pass in jest flags as you might want.

Steps to validate locally

No user-facing changes, all tests should pass.

coolsoftwaretyler commented 7 months ago

Since this is just test files, I'm gonna merge this in on my own here. I've sent the PR along to other maintainers for context sharing, but otherwise I'm gonna take some executive privilege and merge it on in.