mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 04:53:06 +00:00
Added tests
This commit is contained in:
@@ -1080,7 +1080,9 @@ export const mockSubmissionState: SubmissionObjectState = {
|
||||
sectionType: 'upload',
|
||||
collapsed: false,
|
||||
enabled: true,
|
||||
data: {},
|
||||
data: {
|
||||
files: []
|
||||
},
|
||||
errors: [],
|
||||
isLoading: false,
|
||||
isValid: false
|
||||
@@ -1231,3 +1233,357 @@ export const mockSectionsList = [
|
||||
sectionType: 'license'
|
||||
}
|
||||
];
|
||||
|
||||
export const mockUploadConfigResponse = {
|
||||
accessConditionOptions: [
|
||||
{
|
||||
name: 'openaccess',
|
||||
groupUUID: '123456-g',
|
||||
hasStartDate: false,
|
||||
hasEndDate: false
|
||||
},
|
||||
{
|
||||
name: 'lease',
|
||||
groupUUID: '123456-g',
|
||||
hasStartDate: false,
|
||||
hasEndDate: true,
|
||||
maxEndDate: '2019-07-12T14:40:06.308+0000'
|
||||
},
|
||||
{
|
||||
name: 'embargo',
|
||||
groupUUID: '123456-g',
|
||||
hasStartDate: true,
|
||||
hasEndDate: false,
|
||||
maxStartDate: '2022-01-12T14:40:06.308+0000'
|
||||
},
|
||||
{
|
||||
name: 'administrator',
|
||||
groupUUID: '0f2773dd-1741-475f-80e7-ccdef153d655',
|
||||
hasStartDate: false,
|
||||
hasEndDate: false
|
||||
}
|
||||
],
|
||||
metadata: {
|
||||
rows: [
|
||||
{
|
||||
fields: [
|
||||
{
|
||||
input: {
|
||||
type: 'onebox'
|
||||
},
|
||||
label: 'Title',
|
||||
mandatory: true,
|
||||
repeatable: false,
|
||||
mandatoryMessage: 'You must enter a main title for this item.',
|
||||
hints: 'Enter the name of the file.',
|
||||
selectableMetadata: [
|
||||
{
|
||||
metadata: 'dc.title',
|
||||
label: null,
|
||||
authority: null,
|
||||
closed: null
|
||||
}
|
||||
],
|
||||
languageCodes: []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
fields: [
|
||||
{
|
||||
input: {
|
||||
type: 'textarea'
|
||||
},
|
||||
label: 'Description',
|
||||
mandatory: false,
|
||||
repeatable: true,
|
||||
hints: 'Enter a description for the file',
|
||||
selectableMetadata: [
|
||||
{
|
||||
metadata: 'dc.description',
|
||||
label: null,
|
||||
authority: null,
|
||||
closed: null
|
||||
}
|
||||
],
|
||||
languageCodes: []
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
name: 'bitstream-metadata',
|
||||
type: 'submissionform',
|
||||
_links: {
|
||||
self: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/bitstream-metadata'
|
||||
},
|
||||
self: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/bitstream-metadata'
|
||||
},
|
||||
required: false,
|
||||
maxSize: 536870912,
|
||||
name: 'upload',
|
||||
type: 'submissionupload',
|
||||
_links: {
|
||||
metadata: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload/metadata',
|
||||
self: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload'
|
||||
},
|
||||
self: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload'
|
||||
};
|
||||
|
||||
export const mockAccessConditionOptions = [
|
||||
{
|
||||
name: 'openaccess',
|
||||
groupUUID: '123456-g',
|
||||
hasStartDate: false,
|
||||
hasEndDate: false
|
||||
},
|
||||
{
|
||||
name: 'lease',
|
||||
groupUUID: '123456-g',
|
||||
hasStartDate: false,
|
||||
hasEndDate: true,
|
||||
maxEndDate: '2019-07-12T14:40:06.308+0000'
|
||||
},
|
||||
{
|
||||
name: 'embargo',
|
||||
groupUUID: '123456-g',
|
||||
hasStartDate: true,
|
||||
hasEndDate: false,
|
||||
maxStartDate: '2022-01-12T14:40:06.308+0000'
|
||||
},
|
||||
{
|
||||
name: 'administrator',
|
||||
groupUUID: '0f2773dd-1741-475f-80e7-ccdef153d655',
|
||||
hasStartDate: false,
|
||||
hasEndDate: false
|
||||
}
|
||||
];
|
||||
|
||||
export const mockGroup = {
|
||||
handle: null,
|
||||
permanent: true,
|
||||
self: 'https://rest.api/dspace-spring-rest/api/eperson/groups/123456-g1',
|
||||
id: '123456-g',
|
||||
uuid: '123456-g',
|
||||
type: 'group',
|
||||
name: 'Anonymous',
|
||||
metadata: [],
|
||||
_links: {
|
||||
groups: 'https://rest.api/dspace-spring-rest/api/eperson/groups/123456-g1/groups',
|
||||
self: 'https://rest.api/dspace-spring-rest/api/eperson/groups/123456-g1'
|
||||
},
|
||||
groups: {
|
||||
pageInfo: {
|
||||
elementsPerPage: 0,
|
||||
totalElements: 0,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
},
|
||||
page: []
|
||||
}
|
||||
};
|
||||
|
||||
export const mockUploadFiles = [
|
||||
{
|
||||
uuid: '123456-test-upload',
|
||||
metadata: {
|
||||
'dc.source': [
|
||||
{
|
||||
value: '123456-test-upload.jpg',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: '123456-test-upload.jpg',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
],
|
||||
'dc.title': [
|
||||
{
|
||||
value: '123456-test-upload.jpg',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: '123456-test-upload.jpg',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
]
|
||||
},
|
||||
accessConditions: [
|
||||
{
|
||||
id: 3675,
|
||||
name: 'lease',
|
||||
rpType: 'TYPE_CUSTOM',
|
||||
groupUUID: '123456-g',
|
||||
action: 'READ',
|
||||
endDate: '2019-01-16',
|
||||
type: 'resourcePolicy'
|
||||
},
|
||||
{
|
||||
id: 3676,
|
||||
name: 'openaccess',
|
||||
rpType: 'TYPE_CUSTOM',
|
||||
groupUUID: '123456-g',
|
||||
action: 'READ',
|
||||
type: 'resourcePolicy'
|
||||
}
|
||||
],
|
||||
format: {
|
||||
id: 16,
|
||||
shortDescription: 'JPEG',
|
||||
description: 'Joint Photographic Experts Group/JPEG File Interchange Format (JFIF)',
|
||||
mimetype: 'image/jpeg',
|
||||
supportLevel: 0,
|
||||
internal: false,
|
||||
extensions: null,
|
||||
type: 'bitstreamformat'
|
||||
},
|
||||
sizeBytes: 202999,
|
||||
checkSum: {
|
||||
checkSumAlgorithm: 'MD5',
|
||||
value: '5e0996996863d2623439cbb53052bc72'
|
||||
},
|
||||
url: 'https://test-ui.com/api/core/bitstreams/123456-test-upload/content'
|
||||
}
|
||||
];
|
||||
|
||||
export const mockFileFormData = {
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
value: 'title',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: 'title',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
],
|
||||
'dc.description': [
|
||||
{
|
||||
value: 'description',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: 'description',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
]
|
||||
},
|
||||
accessConditions: [
|
||||
{
|
||||
name: [
|
||||
{
|
||||
value: 'openaccess',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: 'openaccess',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
],
|
||||
groupUUID: [
|
||||
{
|
||||
value: '123456-g',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: '123456-g',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
{
|
||||
name: [
|
||||
{
|
||||
value: 'lease',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: 'lease',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
],
|
||||
endDate: [
|
||||
{
|
||||
value: {
|
||||
year: 2019,
|
||||
month: 1,
|
||||
day: 16
|
||||
},
|
||||
language: null,
|
||||
authority: null,
|
||||
display: {
|
||||
year: 2019,
|
||||
month: 1,
|
||||
day: 16
|
||||
},
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
],
|
||||
groupUUID: [
|
||||
{
|
||||
value: '123456-g',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: '123456-g',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
{
|
||||
name: [
|
||||
{
|
||||
value: 'embargo',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: 'lease',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
],
|
||||
startDate: [
|
||||
{
|
||||
value: {
|
||||
year: 2019,
|
||||
month: 1,
|
||||
day: 16
|
||||
},
|
||||
language: null,
|
||||
authority: null,
|
||||
display: {
|
||||
year: 2019,
|
||||
month: 1,
|
||||
day: 16
|
||||
},
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
],
|
||||
groupUUID: [
|
||||
{
|
||||
value: '123456-g',
|
||||
language: null,
|
||||
authority: null,
|
||||
display: '123456-g',
|
||||
confidence: -1,
|
||||
place: 0,
|
||||
otherInformation: null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
Reference in New Issue
Block a user