Unit testing in JS

Why should we make unit tests



  • Facilitates Change
  • Quality of Code
  • Find Software Bugs Early
  • Design



  • Types of Testing





    Unit Testing
    Functional Testing
    Integration Testing

    Unit Testing



    •   The smallest piece of code that can be run indeendently
    •   Written from a programmer's perspective

    Functional Testing





    Functional testing is a way of checking software to ensure that it has all the required functionality that's specified within its functional requirements

    •   written from a user's perspective

    Integration Testing



    Ensure that component collaborations work as expected. Assertions may test component API, UI, or side-effects
    (such as database I/O, logging, etc…)

    FE Testing Framework

    how to run tests in our framework



    Karma + Jasmine


    grunt test --js-file=../commons/components2/table-view/table-view.js
    grunt --tests 







    https://confluence.optymyze.net/display/FED/Testing 

    What to test



    • Services
    • Factories
    • Components
    • Directives
    • etc

    Other testing tools





    • Jest
    • Enzyme
    Made with Slides.com