mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge branch 'request-by-uuid-issue' into metadata-and-relationships-combined-in-submission
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
|||||||
} from './request.models';
|
} from './request.models';
|
||||||
import { RequestEntry } from './request.reducer';
|
import { RequestEntry } from './request.reducer';
|
||||||
import { RequestService } from './request.service';
|
import { RequestService } from './request.service';
|
||||||
|
import { parseJsonSchemaToCommandDescription } from '@angular/cli/utilities/json-schema';
|
||||||
|
|
||||||
describe('RequestService', () => {
|
describe('RequestService', () => {
|
||||||
let scheduler: TestScheduler;
|
let scheduler: TestScheduler;
|
||||||
@@ -178,7 +179,41 @@ describe('RequestService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
describe(`if the request with the specified UUID wasn't sent, because it was already cached`, () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
let callCounter = 0;
|
||||||
|
const responses = [
|
||||||
|
cold('a', { a: undefined }), // No hit in the request cache with that UUID
|
||||||
|
cold('b', { b: 'otherRequestUUID' }), // A hit in the index, which returns the uuid of the cached request
|
||||||
|
cold('c', { c: { // the call to retrieve the cached request using the UUID from the index
|
||||||
|
c: {
|
||||||
|
completed: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
];
|
||||||
|
selectSpy.and.callFake(() => {
|
||||||
|
return () => {
|
||||||
|
const response = responses[callCounter];
|
||||||
|
callCounter++;
|
||||||
|
return () => response;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`it should return the cached request`, () => {
|
||||||
|
const result = service.getByUUID(testUUID);
|
||||||
|
|
||||||
|
scheduler.expectObservable(result).toBe('c', { c: {
|
||||||
|
c: {
|
||||||
|
completed: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
describe('getByHref', () => {
|
describe('getByHref', () => {
|
||||||
describe('when the request with the specified href exists in the store', () => {
|
describe('when the request with the specified href exists in the store', () => {
|
||||||
|
Reference in New Issue
Block a user