Skip to content

Forms: refactor common validators used in unit tests and extract them to util file #37831

Closed

Description

@benbraou

🐞 bug report

Affected Package

The issue is caused by package @angular/forms

Is this a regression?

No, this is a refactor of the existing unit tests

Description

Following #22575 , further refactoring around async validators in forms unit tests were suggested by @AndrewKushnir
#22575 (comment)

I was thinking if we can extract common validators code into a new packages/forms/test/util.ts file (we can store more functions there later). Some validators that are used across many tests (may be you can find more):

  • function asyncValidator
  • function asyncValidatorReturningObservable
  • may be simpleAsyncValidator added in this test can use some common code from asyncValidator
  • I also see a value of moving the currentStateOf function (added in this PR) into the util.ts file, so we can reuse it for other validators-related tests in other files

🔬 Minimal Reproduction

N/A

🔥 Exception or Error

N/A

🌍 Your Environment

Angular Version:
master branch

Anything else relevant?
No

Activity

  1. benbraou commented on Jun 29, 2020

    @benbraou
    ContributorAuthor

    @AndrewKushnir I will be working on this ticket as agreed in #22575 (comment)
    Thank you

  2. modified the milestone: Backlog on Jun 29, 2020
  3. added a commit that references this issue on Jul 22, 2020
    78ad78d
  4. added a commit that references this issue on Jul 23, 2020
    a94cade
  5. added a commit that references this issue on Aug 8, 2020
    8a05f31
  6. angular-automatic-lock-bot commented on Aug 23, 2020

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Aug 23, 2020
  8. added a commit that references this issue on Sep 5, 2020
    ddbd1a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: formsrefactoringIssue that involves refactoring or code-cleanup

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions