Code Monkey home page Code Monkey logo

jasmine-unit-test-generator's People

Contributors

dependabot[bot] avatar fdim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jasmine-unit-test-generator's Issues

fallback to empty object when no methods are used from dependency

fakeElementRef = jasmine.createSpyObj<ElementRef<HTMLElement>>('ElementRef<HTMLElement>', []);

Code above fails at runtime, as jasmine requires at least one method. In this case it might be better to fallback to

fakeElementRef = { } as ElementRef<HTMLElement>;

add dependency handler for router/activated route

since it is a common use case, it should be supported by default

Generated code should have a subject for router events (if used) and params/paramMap/queryParams/queryParamMap

EDIT: handler should also provide RouterTestingModule to component, to handle a case when routerLink is used in template

Typing Error on createSpyObj on a Service

I was testing out this library(thanks for your hard work by the way), and I believe I ran across a small bug. I ran the generate script on a component that uses ActivatedRoute.
constructor(private route: ActivatedRoute, private messageService: MessageService) { }
this.route.params.pipe(take(1)).subscribe((params) => {// do stuff})

The tooling generated the following code, which fails to compile due to a typing error:

fakeRoute = jasmine.createSpyObj<ActivatedRoute>('ActivatedRoute', ['']);

I believe it should be:

fakeRoute = jasmine.createSpyObj<ActivatedRoute>('ActivatedRoute', []);

I believe this happens whenever you inject a service but don't call any methods on that service.

createSpyObj requires a non-empty array or object of method names to create spies for

getting this error

  fakeRouter = jasmine.createSpyObj<Router>("Router", []);
  fakeAuthenticationService = jasmine.createSpyObj<AuthenticationService>("AuthenticationService", []);

error log

Chrome Headless 107.0.5304.107 (Windows 10) AppComponent should create FAILED
        Failed: createSpyObj requires a non-empty array or object of method names to create spies for
            at failCallback (node_modules/zone.js/dist/zone-testing.js:1369:46)
            at apply (node_modules/zone.js/dist/zone-testing.js:1427:25)
    

How hard is it to make it work flawlessly

Hey Domas,

This project is quite interesting. How hard is it to make it work flawlessly?

I mean, the project currently creates a great boilerplate but the ultimate goal could be to create all positive and negative tests.

I'd like to understand what are the pitfalls you have already seen :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.