pepopowitz’s avatarpepopowitz’s Twitter Archive—№ 2,597

  1. …in reply to @housecor
    @housecor @donavon Article: stevenhicks.me/blog/2018/01/chekhovs-gun-and-better-unit-tests/ I think I'm off in my own world on this one. My pref is to have the test include only the data that makes the test unique. In this example, I'd prefer a function named buildUser that handles irrelevant props, and pass relevant props into it. Ex:
    1. …in reply to @pepopowitz
      @housecor @donavon function buildUser(specs) { return { eyeColor: "some color", ...specs } } it('tests something', () => { const user = buildUser({ email: 'user@place.com' }) .... }) The test now shows only the info pertinent to this test.
      1. …in reply to @pepopowitz
        @housecor @donavon I guess in regards to the actual values, I like reasonable values that are obviously fake, but that's definitely less important to me than irrelevant data in every test. Ps it is exhausting writing code on a mobile keyboard 😅