Generic Base for Angular Spec File

Discussão em 'Angular' iniciado por greg, Junho 24, 2025.

  1. greg

    greg Guest

    I have a class hierarchy and let's say 10 tests that need to be run on each concrete subclass.

    It would be great if I could write a subclass spec using generics and then call that from my concrete specs.

    I have had a couple of goes with ChatGPT and we keep running into "It" cannot be called outside a "Describe". It seems to me the approach was calling the base inside a describe.

    Is it possible to have a base spec in Angular 18? I would prefer an approach using generics, but that's not a requirement. If it is possible, can you show a simple base class and then concrete sub class?

    Continue reading...

Compartilhe esta Página