I have a controller that makes a GET request to the server, then based on 
the response from the server, makes *another *GET request.

I have the following in my unit test:

const getSdRequest = httpClient.expectOne('/api/structureDefinition/test');
expect(getSdRequest.request.method).toBe('GET');
getSdRequest.flush({
  resource: {
    resourceType: 'StructureDefinition',
    id: 'test',
    type: 'Composition',
    baseDefinition: 'http://hl7.org/fhir/StructureDefinition/Composition'
  }
});

const getBaseRequest = httpClient.expectOne('/api/structureDefinition/base');
expect(getBaseRequest.request.method).toBe('GET');
getBaseRequest.flush({
  resourceType: 'StructureDefinition',
  id: 'Composition'
});


When the test runs, I get the following errors:

StructureDefinitionComponent › should init
Expected one matching request for criteria "Match URL: 
/api/structureDefinition/base", found none.

StructureDefinitionComponent › should init
Expected no open requests, found 1: GET /api/structureDefinition/base

As you can see, I *am *expecting /api/structureDefinition/base, but the 
test errors that it's not found, and then another error that it *was *
found. 

Does anyone know what's going on here?

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to