Tag "UnitTest" (8 posts)

  • Angular Login Component, Service and UnitTesting

    January 5, 2023 · 8 min read

    Hello 2023, let's have some fun! My first post for this year is the template and logic behind a login screen in angular and the related logic we've added to prevent the user from navigating to pages ...

  • Unit Test Material Date Picker and more Dialog Fun

    March 31, 2022 · 2 min read

    Looking through the posts I've added over the last year or so, I see a lot of them touching the unit testing and there's no way about it, unit testing for angular is hard and even harderd when various...

  • Mocking Services and MatDialog Angular Unit Tests

    November 10, 2021 · 5 min read

    I've spent the last three days writting unit tests and also learning a lot about them. One of the most challenges parts for me was mocking services which are imported and used in a component in order ...

  • Angular Service HTTP testing

    June 23, 2021 · 2 min read

    In order to test a service which uses HTTP Client Module, the following should be added: `javascript import { TestBed } from '@angular/core/testing'; import { NameService } from './name.service'; i...

  • Unit Test Form Custom Validator with Data from Dialog

    April 7, 2021 · 3 min read

    So as I was proof reading my previous post, I realised I can fix another unit test! The functionality I'm trying to test is a custom validator for a form in a modal which brings data from it's paren...

  • Angular Material Dialog Close Unit Test

    April 7, 2021 · 1 min read

    Another day, another unit testing challenge. I swear this feels more difficult than implementing the functionality. Right... The modal component implemented with material dialog has the following piec...