DSpace / dspace-angular

DSpace User Interface built on Angular.io
https://wiki.lyrasis.org/display/DSDOC8x/
BSD 3-Clause "New" or "Revised" License
126 stars 418 forks source link

Tests using services should use mocks instead #281

Open LotteHofstede opened 6 years ago

LotteHofstede commented 6 years ago

Currently some spec files that are dependent on services use the actual service in their tests. This leads to unit tests that can stop working unexpectedly. We should aim to write tests that mock everything but the part we're testing.

List of files I found missing mocked services: https://github.com/DSpace/dspace-angular/blob/master/src/app/core/metadata/metadata.service.spec.ts#L86 https://github.com/DSpace/dspace-angular/blob/master/src/app/shared/notifications/notifications.service.spec.ts#L42 https://github.com/DSpace/dspace-angular/blob/master/src/app/core/data/config-response-parsing.service.spec.ts#L18 https://github.com/DSpace/dspace-angular/blob/master/src/app/core/integration/integration-response-parsing.service.spec.ts#L17 https://github.com/DSpace/dspace-angular/blob/master/src/app/core/auth/auth-response-parsing.service.spec.ts#L17

tdonohue commented 4 years ago

Unclear whether this is still valid as it's nearly 2 years old

artlowel commented 4 years ago

None of these seem to have been fixed yet. Although one service has been removed. I'd keep this ticket open.