117287: Removed method calls returning observables from the Registry Formats page

This commit is contained in:
Alexandre Vryghem
2024-09-03 18:44:49 +02:00
parent 70f0af6611
commit d3019e4006
3 changed files with 34 additions and 46 deletions

View File

@@ -15,8 +15,7 @@ import { NotificationsService } from '../../../shared/notifications/notification
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level';
import { cold, getTestScheduler, hot } from 'jasmine-marbles';
import { TestScheduler } from 'rxjs/testing';
import { hot } from 'jasmine-marbles';
import {
createNoContentRemoteDataObject$,
createSuccessfulRemoteDataObject,
@@ -31,7 +30,6 @@ describe('BitstreamFormatsComponent', () => {
let comp: BitstreamFormatsComponent;
let fixture: ComponentFixture<BitstreamFormatsComponent>;
let bitstreamFormatService;
let scheduler: TestScheduler;
let notificationsServiceStub;
let paginationService;
@@ -86,8 +84,6 @@ describe('BitstreamFormatsComponent', () => {
const initAsync = () => {
notificationsServiceStub = new NotificationsServiceStub();
scheduler = getTestScheduler();
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: observableOf(mockFormatsRD),
find: createSuccessfulRemoteDataObject$(mockFormatsList[0]),
@@ -178,17 +174,17 @@ describe('BitstreamFormatsComponent', () => {
beforeEach(waitForAsync(initAsync));
beforeEach(initBeforeEach);
it('should return an observable of true if the provided bistream is in the list returned by the service', () => {
const result = comp.isSelected(bitstreamFormat1);
expect(result).toBeObservable(cold('b', { b: true }));
comp.selectedBitstreamFormatIDs().subscribe((selectedBitstreamFormatIDs: string[]) => {
expect(selectedBitstreamFormatIDs).toContain(bitstreamFormat1.id);
});
});
it('should return an observable of false if the provided bistream is not in the list returned by the service', () => {
const format = new BitstreamFormat();
format.uuid = 'new';
const result = comp.isSelected(format);
expect(result).toBeObservable(cold('b', { b: false }));
comp.selectedBitstreamFormatIDs().subscribe((selectedBitstreamFormatIDs: string[]) => {
expect(selectedBitstreamFormatIDs).not.toContain(format.id);
});
});
});
@@ -214,8 +210,6 @@ describe('BitstreamFormatsComponent', () => {
beforeEach(waitForAsync(() => {
notificationsServiceStub = new NotificationsServiceStub();
scheduler = getTestScheduler();
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: observableOf(mockFormatsRD),
find: createSuccessfulRemoteDataObject$(mockFormatsList[0]),
@@ -263,8 +257,6 @@ describe('BitstreamFormatsComponent', () => {
beforeEach(waitForAsync(() => {
notificationsServiceStub = new NotificationsServiceStub();
scheduler = getTestScheduler();
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: observableOf(mockFormatsRD),
find: createSuccessfulRemoteDataObject$(mockFormatsList[0]),