mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
115284: Add tests for isRepeatable
This commit is contained in:
@@ -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(), {
|
entityTypeLeft = Object.assign(new ItemType(), {
|
||||||
id: leftType,
|
id: leftType,
|
||||||
uuid: leftType,
|
uuid: leftType,
|
||||||
@@ -130,6 +130,8 @@ describe('EditRelationshipListComponent', () => {
|
|||||||
rightType: createSuccessfulRemoteDataObject$(entityTypeRight),
|
rightType: createSuccessfulRemoteDataObject$(entityTypeRight),
|
||||||
leftwardType: `is${rightType}Of${leftType}`,
|
leftwardType: `is${rightType}Of${leftType}`,
|
||||||
rightwardType: `is${leftType}Of${rightType}`,
|
rightwardType: `is${leftType}Of${rightType}`,
|
||||||
|
leftMaxCardinality: leftMaxCardinality,
|
||||||
|
rightMaxCardinality: rightMaxCardinality,
|
||||||
});
|
});
|
||||||
|
|
||||||
paginationOptions = Object.assign(new PaginationComponentOptions(), {
|
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