Thank you for reading the article :). I agree with things you wrote in your article, what I meant by avoiding magic values is to approve the readability of tests when you have some complex setups (for example you setup a database to test your repository layer). In those cases, I have found it is very hard to determine what some value means. If values are self-evident like in your example then I completely agree that you can inline the value.
Luís Soares
software developer
Nice article! My 2 cent: Usually, I don't agree with "Avoid magic numbers or strings". I wrote an article about it. I prefer DAMP and Evident Data (Kent Beck).
I'd do instead:
const userPosts = callToGetUserPosts(); expect(userPosts).toBe(1);which is a self-documenting single-liner.