Is reactive code with RxJS too hard to test?

Поделиться
HTML-код
  • Опубликовано: 28 янв 2025

Комментарии • 29

  • @JoshuaMorony
    @JoshuaMorony  Год назад

    Join my mailing list for more exclusive content and access to the archive of my private tips of the week: mobirony.ck.page/4a331b9076

  • @richiekosher6218
    @richiekosher6218 2 года назад +5

    so nice to have someone go beyond "create a todo-list-app with randomframework in 5 minutes" and really explain topics beyond

  • @saylorsedell2380
    @saylorsedell2380 2 года назад +3

    Liked, subscribed and very grateful for an awesome video! The observer-spy sounds like a game-changer so will definitely look into it! Also your photo's remind me of the various emotional state a programmer goes through while writing tests XD

  • @matiasmiraballes9240
    @matiasmiraballes9240 2 года назад

    this video is just in time. I was just trying to figure out how to use observer-spy. Thanks, great video as always

  • @emeraldelnas4833
    @emeraldelnas4833 2 года назад +3

    Great video again!
    Do you have a tutorial about testing for beginners?

    • @JoshuaMorony
      @JoshuaMorony  2 года назад

      I have a few different videos about testing on my channel, some of them are a bit older now. The only "proper" guide to testing I have is this module on Elite Ionic: eliteionic.com/modules/test-driven-development/ some of the lessons are free but it is part of a paid course

  • @aaronhauth8880
    @aaronhauth8880 22 дня назад

    I just encountered this video and that lib looks suuuuper nice! Is it stable/production-ready?

    • @JoshuaMorony
      @JoshuaMorony  21 день назад +1

      Observer spy? Yeah absolutely it's been around for a long time now

  • @Charon061
    @Charon061 2 года назад +1

    Could you provide link to repo. I want to check testing with marbles on yours use case

    • @JoshuaMorony
      @JoshuaMorony  2 года назад

      Which one were you interested in? There's a bunch of different repos I'm showing in this video

    • @Charon061
      @Charon061 2 года назад

      @@JoshuaMorony That one with `Complex Stream`

    • @JoshuaMorony
      @JoshuaMorony  2 года назад

      @@Charon061 sure: github.com/joshuamorony/ionicstart-snapaday/blob/insta-story-v2/src/app/slideshow/slideshow.component.ts

    • @asiacarter359
      @asiacarter359 2 года назад

      @@JoshuaMorony Would you mind linking the repo for the LoginStore spec example?

  • @Supaship6000
    @Supaship6000 2 года назад

    Killing it with these videos!!

  • @michaelfaith
    @michaelfaith 2 года назад +2

    Nice video. But I think the one big flaw of the approach in the last example is that it requires all the Subjects to be public, when, traditionally, i think they should be private. Do you have a solution for when the Subjects are private?

    • @JoshuaMorony
      @JoshuaMorony  2 года назад +3

      I make a point to never change my code to make the tests viable, and often you do run into situations like this where you can't access something because it is private - but then I always just change the test because with the black box style approach I shouldn't need to access private things.
      In this case, the subjects are actually meant to be public as I am next-ing them from the template. However, if they were private and say I had methods being called from the template instead then I would either just trigger that method instead of nexting the subject, or I could also trigger the click handler in the template if I wanted to as well.

    • @michaelfaith
      @michaelfaith 2 года назад +1

      @@JoshuaMorony Solid answer. I think with the recent update of making protected members accessible by the template, it seems like even in this case, those subjects could be protected and hard to get to, which I guess would just leave triggering the clicks as your input to the test?

    • @JoshuaMorony
      @JoshuaMorony  2 года назад +2

      @@michaelfaith yes I think that would be the most correct way to do it (triggering a click) as that is how it would actually be interacted with, my approach at the moment makes the tests a bit easier/nicer to write but also run the risk of being bitten by a refactor (i.e. if a code reviewer like yourself wanted to make those class members protected before merging lol)

  • @asatorftw
    @asatorftw 2 года назад

    Do you have a video on choosing when to use ngrx component store vs global store? Im experimented a bit with component store recently but cant rly think of a scenario that I cant handle smoother with global store. Mostly because im missing actions.

    • @JoshuaMorony
      @JoshuaMorony  2 года назад

      For me it's just always Component Store until Store becomes apparently necessary, but for me I never run into those situations - I think the benefit usually comes up more in larger teams with more complex apps, and I am generally just developing alone. However, if you are productive with Store and like using it, then I think there is no reason not to use it even for the most simple circumstances (although it still probably makes sense to use Component Store for state that is local to just a single component - but again, that's up to you).

  • @jonathangamble
    @jonathangamble 2 года назад

    you should put an underscore in front of index since you're not using the first parameter

  • @DavidWeiss2
    @DavidWeiss2 2 года назад

    Thanks!

  • @MattBodman
    @MattBodman Год назад

    Wondering if you've started testing Angular with Cypress yet?

    • @JoshuaMorony
      @JoshuaMorony  Год назад +1

      I've been doing E2E tests with Cypress in Angular for a long time, but I haven't touched component testing with Cypress yet

    • @MattBodman
      @MattBodman Год назад

      @@JoshuaMorony have you made videos on Cypress?

    • @JoshuaMorony
      @JoshuaMorony  Год назад +1

      @@MattBodman I have a few where I use Cypress like this one: ruclips.net/video/uefGmRcIm3c/видео.html generally any of my videos on TDD or E2E - but I don't really have a deep dive into how Cypress works or anything like that

  • @pedrofernandes2005
    @pedrofernandes2005 2 года назад

    I'm assuming you are using NX because "standard" Angular does not have Jest. So for a lot of people this might be even more confusing because the testing methods are not exactly the same.

    • @JoshuaMorony
      @JoshuaMorony  2 года назад +2

      The apps in this video aren't using Nx, but yes Jest was installed separately using the briebug schematic