Angular + Jasmine: How to ignore/ mock one function in the tested component (not in a dependency)?

I know how to mock a function from a dependency, but now I have one function that is not in a dependency, it’s in the actual component that I want to test. How can I tell jasmine to simply ignore it? When I run ng test this test fails: The reason for this is this […]

By bwx--2
Published
Categorized as angular, contentful, jasmine, mocking, unit-testing Tagged , , , ,

Angular Jasmine + Contentful: How to Test a Contentful call?

I’m using Contentful to load text into my Angular Singel Page Application. It works fine but now I want to test it. The test should actually call Contentful and load the text of myPage from my space. Then I want to assert that an expected value (the title field of myPage) is not null. This […]

By bwx--2
Published
Categorized as angular, contentful, jasmine Tagged , ,

Configure angular-oauth2-oidc in other component than the AppComponent

I used the angular-oauth2-oidc library to implement an oAuth authorization code fow with PKCE in my AppComponent. It works fine and I’m even able to pass in some custom query parameters that I need to change the login form that I receive from my oAuth authorization server according to the user’s language and country. But […]

By bwx--2
Published
Categorized as angular, angular-oauth2-oidc, oauth-2.0 Tagged , ,

Authorization Code Flow with PKCE in Angular with angular-oauth2-oidc

I want to use the code flow with PKCE in my Angular SPA and for convenience I use this library: angular-oauth2-oidc If you click on the link, it says that with this configuration you will use the code flow with PKCE: let authConfig: AuthConfig = { issuer: ‘https://myIssuerURL.com’, redirectUri: ‘https://myRedirectURI.com’, clientId: environment.myclientId, scope: ‘openid’, responseType: […]

Angular *ngFor over a map is running multiple times but should only run once

Stackblitz Demo of my app In my app I try to loop over a map (with *ngFor) and display every map key in a new expansion panel and the values in the "body" of the expansion panel: The map has strings as keys and string arrays as values. After I have filled my map I […]

By bwx--2
Published
Categorized as angular, javascript, ngfor Tagged , ,

Angular Jasmine Test: SPEC HAS NO EXPECTATIONS when using setTimeout

I’m trying to write a unit test for a components in my App. It’s a very simple component called TroubleShootingPage that is only supposed to show a help page, if someone has trouble somewhere in the rest of my app. All tests are passing, but in the output in Karma I see a hint: SPEC […]

By bwx--2
Published
Categorized as angular, jasmine, unit-testing Tagged , ,

E2E Test with Protractor and Angular: Make protractor wait while browser is loading

I’m testing a webpage that is accessing a third website for handling the login (oAuth). In order to test my webpage, I first need to make my e2e test log in at the third website. I’m able to locate the input element for the user email address on the third website and enter it. Then […]

By bwx--2
Published
Categorized as angular, angular-e2e, protractor Tagged , ,

Pass 1 parameter in oAuth to access them after redirect URI was called

I have configured a oAuth 2.0 authentication flow for my Angular singlePage website: User opens my Login page depending on his language: example.com/en-GB or example.com/de-DE After clicking on a login Btn he get’s redirected to the issuer page where he can login with his email and password. The issuer page then redirects him to example.com/welcome […]

By bwx--2
Published
Categorized as angular, oauth-2.0 Tagged ,

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq