forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathitem.mock.ts
More file actions
305 lines (294 loc) · 8.7 KB
/
Copy pathitem.mock.ts
File metadata and controls
305 lines (294 loc) · 8.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
import { of as observableOf } from 'rxjs';
import { BitstreamFormat } from '../../core/shared/bitstream-format.model';
import { Bitstream } from '../../core/shared/bitstream.model';
import { Item } from '../../core/shared/item.model';
import { createSuccessfulRemoteDataObject$ } from '../remote-data.utils';
import { createPaginatedList } from '../testing/utils.test';
import { Bundle } from '../../core/shared/bundle.model';
export const MockBitstreamFormat1: BitstreamFormat = Object.assign(new BitstreamFormat(), {
shortDescription: 'Microsoft Word XML',
description: 'Microsoft Word XML',
mimetype: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
supportLevel: 0,
internal: false,
extensions: null,
_links:{
self: {
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/10'
}
}
});
export const MockBitstreamFormat2: BitstreamFormat = Object.assign(new BitstreamFormat(), {
shortDescription: 'Adobe PDF',
description: 'Adobe Portable Document Format',
mimetype: 'application/pdf',
supportLevel: 0,
internal: false,
extensions: null,
_links:{
self: {
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/4'
}
}
});
export const MockBitstreamFormat3: BitstreamFormat = Object.assign(new BitstreamFormat(), {
shortDescription: 'Binary',
description: 'Some scary unknown binary file',
mimetype: 'application/octet-stream',
supportLevel: 0,
internal: false,
extensions: null,
_links:{
self: {
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/17'
}
}
});
export const MockBitstream1: Bitstream = Object.assign(new Bitstream(),
{
sizeBytes: 10201,
content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713/content',
format: createSuccessfulRemoteDataObject$(MockBitstreamFormat1),
bundleName: 'ORIGINAL',
_links:{
self: {
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/cf9b0c8e-a1eb-4b65-afd0-567366448713'
}
},
id: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
uuid: 'cf9b0c8e-a1eb-4b65-afd0-567366448713',
type: 'bitstream',
metadata: {
'dc.title': [
{
language: null,
value: 'test_word.docx'
}
]
}
});
export const MockBitstream2: Bitstream = Object.assign(new Bitstream(), {
sizeBytes: 31302,
content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/99b00f3c-1cc6-4689-8158-91965bee6b28/content',
format: createSuccessfulRemoteDataObject$(MockBitstreamFormat2),
bundleName: 'ORIGINAL',
id: '99b00f3c-1cc6-4689-8158-91965bee6b28',
uuid: '99b00f3c-1cc6-4689-8158-91965bee6b28',
type: 'bitstream',
_links: {
self: { href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/99b00f3c-1cc6-4689-8158-91965bee6b28' },
content: { href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/99b00f3c-1cc6-4689-8158-91965bee6b28/content' },
format: { href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/4' },
bundle: { href: '' }
},
metadata: {
'dc.title': [
{
language: null,
value: 'test_pdf.pdf'
}
]
}
});
export const MockBitstream3: Bitstream = Object.assign(new Bitstream(), {
sizeBytes: 4975123,
content: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/4db100c1-e1f5-4055-9404-9bc3e2d15f29/content',
format: createSuccessfulRemoteDataObject$(MockBitstreamFormat3),
bundleName: 'ORIGINAL',
id: '4db100c1-e1f5-4055-9404-9bc3e2d15f29',
uuid: '4db100c1-e1f5-4055-9404-9bc3e2d15f29',
type: 'bitstream',
_links: {
self: { href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/4db100c1-e1f5-4055-9404-9bc3e2d15f29' },
content: { href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/4db100c1-e1f5-4055-9404-9bc3e2d15f29/content' },
format: { href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreamformats/17' },
bundle: { href: '' }
},
metadata: {
'dc.title': [
{
language: null,
value: 'scary'
}
]
}
});
export const MockOriginalBundle: Bundle = Object.assign(new Bundle(), {
name: 'ORIGINAL',
primaryBitstream: createSuccessfulRemoteDataObject$(MockBitstream2),
bitstreams: observableOf(Object.assign({
_links: {
self: {
href: 'dspace-angular://aggregated/object/1507836003548',
}
},
requestPending: false,
responsePending: false,
isSuccessful: true,
errorMessage: '',
state: '',
error: undefined,
isRequestPending: false,
isResponsePending: false,
isLoading: false,
hasFailed: false,
hasSucceeded: true,
statusCode: '202',
pageInfo: {},
payload: {
pageInfo: {
elementsPerPage: 20,
totalElements: 3,
totalPages: 1,
currentPage: 2
},
page: [
MockBitstream1,
MockBitstream2
]
}
}))
});
/* eslint-disable @typescript-eslint/no-shadow */
export const ItemMock: Item = Object.assign(new Item(), {
handle: '10673/6',
lastModified: '2017-04-24T19:44:08.178+0000',
isArchived: true,
isDiscoverable: true,
isWithdrawn: false,
bundles: createSuccessfulRemoteDataObject$(createPaginatedList([
MockOriginalBundle,
])),
_links:{
self: {
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/items/0ec7ff22-f211-40ab-a69e-c819b0b1f357'
}
},
id: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
uuid: '0ec7ff22-f211-40ab-a69e-c819b0b1f357',
type: 'item',
metadata: {
'dc.creator': [
{
language: 'en_US',
value: 'Doe, Jane'
}
],
'dc.date.accessioned': [
{
language: null,
value: '1650-06-26T19:58:25Z'
}
],
'dc.date.available': [
{
language: null,
value: '1650-06-26T19:58:25Z'
}
],
'dc.date.issued': [
{
language: null,
value: '1650-06-26'
}
],
'dc.identifier.issn': [
{
language: 'en_US',
value: '123456789'
}
],
'dc.identifier.uri': [
{
language: null,
value: 'http://dspace7.4science.it/xmlui/handle/10673/6'
}
],
'dc.description.abstract': [
{
language: 'en_US',
value: 'This is really just a sample abstract. If it was a real abstract it would contain useful information about this test document. Sorry though, nothing useful in this paragraph. You probably shouldn\'t have even bothered to read it!'
}
],
'dc.description.provenance': [
{
language: 'en',
value: 'Made available in DSpace on 2012-06-26T19:58:25Z (GMT). No. of bitstreams: 2\r\ntest_ppt.ppt: 12707328 bytes, checksum: a353fc7d29b3c558c986f7463a41efd3 (MD5)\r\ntest_ppt.pptx: 12468572 bytes, checksum: 599305edb4ebee329667f2c35b14d1d6 (MD5)'
},
{
language: 'en',
value: 'Restored into DSpace on 2013-06-13T09:17:34Z (GMT).'
},
{
language: 'en',
value: 'Restored into DSpace on 2013-06-13T11:04:16Z (GMT).'
},
{
language: 'en',
value: 'Restored into DSpace on 2017-04-24T19:44:08Z (GMT).'
}
],
'dc.language': [
{
language: 'en_US',
value: 'en'
}
],
'dc.rights': [
{
language: 'en_US',
value: '© Jane Doe'
}
],
'dc.subject': [
{
language: 'en_US',
value: 'keyword1'
},
{
language: 'en_US',
value: 'keyword2'
},
{
language: 'en_US',
value: 'keyword3'
}
],
'dc.title': [
{
language: 'en_US',
value: 'Test PowerPoint Document'
}
],
'dc.type': [
{
language: 'en_US',
value: 'text'
}
]
},
owningCollection: observableOf({
_links: {
self: {
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb'
}
},
requestPending: false,
responsePending: false,
isSuccessful: true,
errorMessage: '',
statusCode: '202',
pageInfo: {},
payload: []
}
)
});
/* eslint-enable @typescript-eslint/no-shadow */
// `metadata` is copied because spec helpers mutate it in place and would hit ItemMock too.
export const NonDiscoverableItemMock: Item = Object.assign(new Item(), ItemMock, {
handle: '10673/7',
id: '0ec7ff22-f211-40ab-a69e-c819b0b1f358',
uuid: '0ec7ff22-f211-40ab-a69e-c819b0b1f358',
isDiscoverable: false,
metadata: Object.assign({}, ItemMock.metadata),
});