question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

backport angular 2 unit testing capabilities

See original GitHub issue
  • app logic migration is number 1 priority, what about testing?

currently we provide renderFactory which leverages angular 1 testing patterns.

We need to do better and support https://angular.io/docs/ts/latest/api/#!?apiFilter=core%2Ftesting

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
JamesHenrycommented, Sep 19, 2016

Yeah, thanks @aciccarello! I would say it is definitely fair to assume that all Angular 1 projects have angular-mocks as a peerDependency already. If they don’t, they have bigger problems than ng-metadata utilities not working 😄

1reaction
aciccarellocommented, Oct 6, 2016

@michaelkrog, currently the easiest way to do this is to use the getInjectableName() function to get the dependency injection string and the angular $injector service to get the instance of your service.

In the future you will be able to use angular 2-like apis such as

import { inject } from 'ng-metadata/testing';
import { UserService } from './user.service';

inject([UserService], (userService: UserService) => {
  // Use instance of UserService in test
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing Services in Angular 2 - Semaphore Tutorial
In this article, we'll explore how to use a test-driven development (TDD) approach to incorporate services into our Angular applications.
Read more >
Testing - Angular
The testing documentation offers tips and techniques for unit and integration testing Angular applications through a sample application created with the ...
Read more >
unittest2 - PyPI
unittest2 is a backport of the new features added to the unittest testing ... pip install -e . on Python3.2 in the unittest2...
Read more >
Untitled
Update source - Remove __pycache__ folder from tests - Make click own its ... Re-enable tests - Backport using sed unit-tests fix from...
Read more >
simplemattable - npm
A simplified, declarative table-library using @angular/material's MatTable with form capabilities for adding/editing/deleting data. Latest version: 14.0.0, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found