mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
115284: Add tests for isRepeatable
(cherry picked from commit 161daffcc0
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
e4a464d44f
commit
48f7e51695
@@ -110,7 +110,7 @@ describe('EditRelationshipListComponent', () => {
|
||||
},
|
||||
};
|
||||
|
||||
function init(leftType: string, rightType: string): void {
|
||||
function init(leftType: string, rightType: string, leftMaxCardinality?: number, rightMaxCardinality?: number): void {
|
||||
entityTypeLeft = Object.assign(new ItemType(), {
|
||||
id: leftType,
|
||||
uuid: leftType,
|
||||
@@ -130,6 +130,8 @@ describe('EditRelationshipListComponent', () => {
|
||||
rightType: createSuccessfulRemoteDataObject$(entityTypeRight),
|
||||
leftwardType: `is${rightType}Of${leftType}`,
|
||||
rightwardType: `is${leftType}Of${rightType}`,
|
||||
leftMaxCardinality: leftMaxCardinality,
|
||||
rightMaxCardinality: rightMaxCardinality,
|
||||
});
|
||||
|
||||
paginationOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
@@ -402,4 +404,31 @@ describe('EditRelationshipListComponent', () => {
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Is repeatable relationship', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
currentItemIsLeftItem$ = new BehaviorSubject<boolean>(true);
|
||||
}));
|
||||
describe('when max cardinality is 1', () => {
|
||||
beforeEach(waitForAsync(() => init('Publication', 'OrgUnit', 1, undefined)));
|
||||
it('should return false', () => {
|
||||
const result = (comp as any).isRepeatable();
|
||||
expect(result).toBeFalse();
|
||||
});
|
||||
});
|
||||
describe('when max cardinality is 2', () => {
|
||||
beforeEach(waitForAsync(() => init('Publication', 'OrgUnit', 2, undefined)));
|
||||
it('should return true', () => {
|
||||
const result = (comp as any).isRepeatable();
|
||||
expect(result).toBeTrue();
|
||||
});
|
||||
});
|
||||
describe('when max cardinality is undefined', () => {
|
||||
beforeEach(waitForAsync(() => init('Publication', 'OrgUnit', undefined, undefined)));
|
||||
it('should return true', () => {
|
||||
const result = (comp as any).isRepeatable();
|
||||
expect(result).toBeTrue();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user