<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: tamburusdanilo</title>
    <description>The latest articles on DEV Community by tamburusdanilo (@tamburusdanilo).</description>
    <link>https://dev.to/tamburusdanilo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F615212%2Fc76851d8-4106-4f70-bbce-3533cdd58ed6.png</url>
      <title>DEV Community: tamburusdanilo</title>
      <link>https://dev.to/tamburusdanilo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tamburusdanilo"/>
    <language>en</language>
    <item>
      <title>Help with jasmine Promise then testing</title>
      <dc:creator>tamburusdanilo</dc:creator>
      <pubDate>Thu, 15 Apr 2021 18:35:02 +0000</pubDate>
      <link>https://dev.to/tamburusdanilo/help-with-jasmine-promise-then-testing-25i6</link>
      <guid>https://dev.to/tamburusdanilo/help-with-jasmine-promise-then-testing-25i6</guid>
      <description>&lt;p&gt;Good evening Angular developers, particularly those involved with jasmine unit testing...&lt;br&gt;
I have a hard time when it comes to more complex testing scenarios, I would like a little help from anyone who might help...&lt;/p&gt;

&lt;p&gt;I am trying increase the code cover in my unit tests, but whe it comes to the code inside the "then" and "catch" block of my promises, I simply cannot coverage of my application, as shown in the print.&lt;/p&gt;

&lt;p&gt;Within my spec file, I tried the following:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;it('should return app values', fakeAsync (async () =&amp;gt; {
const mockValues = {test: 123};

const mockSubject = new Subject&amp;lt;any&amp;gt;(); // create subject of your object type

const energiaServiceStub: EnergiaService = TestBed.inject(EnergiaService);

spyOn(energiaServiceStub, 'get').and.returnValue(mockSubject.asObservable());
await service.getAgenteInformacoesCadastrais(consultaContratoRequestMock);
mockSubject.next(mockValues);
mockSubject.complete();
tick();
expect(component.historic).toBeDefined();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Thanks in advance folks! &amp;lt;3&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
