Salesforce Developer Tutorial (LWC) - The Complete Guide to LWC Jest Tests in 2023

Поділитися
Вставка
  • Опубліковано 25 лип 2024
  • In this episode we go over absolutely everything you need to know about writing jest tests for your Lightning Web Components!
    Please consider donating to help continue to improve the content produced for Coding With The Force: www.paypal.com/donate?busines...
    Get Coding With The Force Merch Here: my-store-d20559.creator-sprin...
    Github Wiki: github.com/Coding-With-The-Fo...
    Github Code Examples: github.com/Coding-With-The-Fo...
    Information on Promises: www.freecodecamp.org/news/jav...
    Follow all of our social media here:
    Patreon: / codingwiththeforce
    Github: github.com/Coding-With-The-Force
    Facebook: / codingwiththeforce
    Twitter: / coding_force
    Instagram: / codingwiththeforce
    Salesforce development books I recommend:
    Advanced Apex Programming: amzn.to/3lXi8to
    Salesforce Lightning Platform Enterprise Architecture: amzn.to/2R0D4BQ
    Mastering Salesforce DevOps: amzn.to/3lTtTRN
    Good Non-SF Specific Development Books:
    Clean Code: amzn.to/35PuMDU
    Clean Architecture: amzn.to/35FYo6A
    -----------------------------------------------------------------------------------------------------------------------
    Table of Contents:
    0:00 - Intro
    0:59 - What are Jest Tests and why write them?
    2:51 - How to setup your machine to run Jest Tests
    5:13 - How to setup your SF Project to run Jest Tests
    11:07 - Learning the basics of Jest Tests
    18:11 - How to run Jest Tests
    24:00 - How to test LWC Bind Variables
    27:57 - The beforeEach method
    37:41 - How to test Events and Conditional Rendering
    51:11 - The afterEach method
    56:08 - How to test Iterators
    1:09:50 - How to test Apex wire methods
    1:38:26 - How to test Standard wire methods
    1:48:57 - How to test Apex Method Calls
    2:06:59 - How to test a Child LWC
    2:15:23 - Outro
    DISCLAIMER: The views and ideas expressed on this UA-cam channel and blog are based on past development experiences and may not always work for your particular scenarios. The advice in these videos may also become outdated as technology advances. They should be used as examples for educational purposes only. Using any shown solutions in your own org is not advisable since they are example scenarios.
    #salesforce #salesforcedeveloper #salesforceadmin

КОМЕНТАРІ • 13

  • @zthroescha
    @zthroescha Місяць тому

    One of my absolute favorite walk-throughs. Perfect!

  • @SfdcLearner
    @SfdcLearner Рік тому +2

    ThanksYou Great Content to start with JEST. waiting for some advanced topics

  • @alanbirchenough
    @alanbirchenough 7 місяців тому +2

    Excellent video. You don't force me to come back for a dozen or so sloppily scripted talks that go at a snail's pace; instead I can go from "zero to hero" with a meaty topic like Jest LWC testing in a couple of hours. One pro tip I might recommend: It is very easy to get JSON for wire tests via the CLI. Just run your query using 'sf data query ...' and include the '--json' output option and redirect standard output to a file. Then you will have to strip off a couple of levels of cruft enclosing the data you really want - i.e., that big old array of records you queried for - but that doesn't take a moment. If I ever got around to things I guess I might write a jq filter to strip that stuff off every time. Oh well...

  • @isaacjessop
    @isaacjessop 22 дні тому

    Thanks!

  • @CodingWithTheForce
    @CodingWithTheForce  Рік тому +4

    If you're jumping around a lot in this video and you get lost, make sure to at least watch the chapter about the beforeEach method at 27:57. It will likely get you back on track.
    Also, Something I realize I forgot to mention in this video is, these days if you install the Salesforce CLI I believe it also installs node.js and npm, so you may not need to actually install them if you have recently installed the Salesforce CLI.

  • @_ohmummy
    @_ohmummy 6 місяців тому

    Thank you, very interesting

  • @Vitalii_Ivakin
    @Vitalii_Ivakin 8 місяців тому

    Thanks you for this video. Very helpful as always

  • @warlockZ-zl3oq
    @warlockZ-zl3oq 7 місяців тому

    cool, thank you for your sharing🥳

  • @glenmatthes8839
    @glenmatthes8839 Рік тому +1

    Seeing all the test failures as you went along was perfect. That type of stuff happens all the time, but it's also why we test!

    • @zthroescha
      @zthroescha Місяць тому

      I half-wonder of those "mistakes" were on purpose? They were instructive in-and-of themselves.

  • @david57989
    @david57989 Рік тому

    @CodingWithTheForce... There is an error at 1:18:14. The JSON data is not available in the connectedCallback for accounts. I had to get that data via the renderedCallback. Thanks for making this video. Huge help! Keep up the awesome work.

  • @bharathsimha2822
    @bharathsimha2822 Рік тому +1

    Can you do one session salesforce delta deployment in azure devops yaml pipeline CiCD

  • @granfaloon
    @granfaloon Рік тому

    Are you going to TrailblazerDx this year?