@localazy/strapi-plugin 0.1.10 → 0.1.11-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.eslintrc +6 -2
  2. package/admin/src/modules/@common/models/supported-content-type-fields.js +8 -0
  3. package/admin/src/modules/plugin-settings/components/ContentTransferSetup/index.js +5 -0
  4. package/admin/src/modules/plugin-settings/components/Tree/index.js +22 -5
  5. package/admin/src/modules/plugin-settings/functions/build-content-transfer-setup-schema.js +1 -1
  6. package/admin/src/modules/plugin-settings/functions/has-model-changed.js +1 -1
  7. package/admin/src/modules/plugin-settings/locale/en.js +1 -1
  8. package/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.js +1 -7
  9. package/admin/src/modules/plugin-settings/utils/get-models-tree.js +21 -3
  10. package/package.json +4 -4
  11. package/server/bootstrap.js +15 -1
  12. package/server/controllers/localazy-transfer-controller.js +67 -52
  13. package/server/functions/should-set-downloaded-property.js +61 -0
  14. package/server/models/supported-content-type-fields.js +8 -0
  15. package/server/services/index.js +2 -0
  16. package/server/services/strapi-i18n-service.js +5 -4
  17. package/server/services/strapi-localazy-i18n-service.js +104 -0
  18. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-cookbook.js +5761 -0
  19. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-lesson-dz.js +392 -0
  20. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-restaurant-simple-menu.js +536 -0
  21. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-sample-json-dz.js +4675 -0
  22. package/server/tests/fixtures/parsed-localazy-entry-to-update-entry.js +35157 -0
  23. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook-empty-recipes.js +202 -0
  24. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook.js +2700 -0
  25. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-lesson-dz.js +309 -0
  26. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-simple.js +47 -0
  27. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-with-media.js +169 -0
  28. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-empty.js +3003 -0
  29. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-with-media.js +2057 -0
  30. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json-dz.js +884 -0
  31. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json.js +46 -0
  32. package/server/tests/fixtures/strapi-plugin-all-models.js +2048 -0
  33. package/server/utils/__tests__/get-models-tree.test.js +1 -1
  34. package/server/utils/__tests__/parsed-localazy-entry-to-create-entry.test.js +237 -91
  35. package/server/utils/__tests__/parsed-localazy-entry-to-update-entry.test.js +417 -101
  36. package/server/utils/__tests__/pick-entries.test.js +936 -56
  37. package/server/utils/__tests__/populate-create-update-entry-with-base-entry.test.js +1139 -0
  38. package/server/utils/build-populate.js +5 -0
  39. package/server/utils/get-full-populate-object.js +56 -0
  40. package/server/utils/get-models-tree.js +3 -1
  41. package/server/utils/model-utils.js +43 -0
  42. package/server/utils/omit-deep.js +7 -0
  43. package/server/utils/parsed-localazy-entry-to-create-entry.js +58 -21
  44. package/server/utils/parsed-localazy-entry-to-update-entry.js +44 -4
  45. package/server/utils/pick-deep.js +22 -0
  46. package/server/utils/pick-entries.js +90 -5
  47. package/server/utils/populate-create-update-entry-with-base-entry.js +270 -0
  48. package/server/utils/transfer-setup-utils.js +14 -0
  49. package/server/tests/fixtures/all-models-with-multimedia.js +0 -1064
  50. package/server/tests/fixtures/collection-flattened.js +0 -76
  51. package/server/tests/fixtures/restaurant-flattened.js +0 -46
  52. package/server/tests/fixtures/restaurant-model.js +0 -230
  53. package/server/tests/fixtures/restaurants-entries.js +0 -152
  54. package/server/tests/fixtures/restaurants-pick-paths.js +0 -15
  55. package/server/tests/fixtures/strapi-book-with-multimedia-components-cs.js +0 -31
  56. package/server/tests/fixtures/stringified-book-cs.js +0 -3
  57. package/server/tests/fixtures/stringified-book-with-multimedia-components-cs.js +0 -3
  58. package/server/tests/fixtures/stringified-restaurant-cs.js +0 -3
  59. package/server/tests/fixtures/stringified-restaurant-de.js +0 -5
@@ -0,0 +1,1139 @@
1
+ "use strict";
2
+
3
+ const allModels = require("../../tests/fixtures/strapi-plugin-all-models");
4
+ const simpleFlatSimpleModel = require("../../tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-simple");
5
+ const simpleFlatWithMediaModel = require("../../tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-with-media");
6
+ const simpleMenuWithMediaModel = require("../../tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-with-media");
7
+ const simpleMenuEmptyModel = require("../../tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-empty");
8
+ const sampleJSONModel = require("../../tests/fixtures/populate-create-update-entry-with-base-entry-sample-json");
9
+ const cookbookModel = require("../../tests/fixtures/populate-create-update-entry-with-base-entry-cookbook");
10
+ const cookbookEmptyRecipesModel = require("../../tests/fixtures/populate-create-update-entry-with-base-entry-cookbook-empty-recipes");
11
+ const sampleJSONWithDZsModel = require("../../tests/fixtures/populate-create-update-entry-with-base-entry-sample-json-dz");
12
+ const lessonWithDZsModel = require("../../tests/fixtures/populate-create-update-entry-with-base-entry-lesson-dz");
13
+
14
+ const populateCreateUpdateEntryWithBaseEntry = require("../populate-create-update-entry-with-base-entry");
15
+
16
+ describe("populate-create-update-entry-with-base-entry.js", () => {
17
+ it("should populate a 'restaurant-simple-flat' correctly", async () => {
18
+ const populatedEntry = await populateCreateUpdateEntryWithBaseEntry(
19
+ allModels,
20
+ simpleFlatSimpleModel.updateEntry,
21
+ simpleFlatSimpleModel.baseEntry,
22
+ simpleFlatSimpleModel.fullyPopulatedLocalizedEntry,
23
+ simpleFlatSimpleModel.uid,
24
+ simpleFlatSimpleModel.locale,
25
+ );
26
+
27
+ const expected = {
28
+ id: 47,
29
+ name: "hlad, okno",
30
+ description: "Orientální pouliční jídlo v ústech rychlé a snadné!",
31
+ established_at: "2022-10-01",
32
+ is_franchise: false,
33
+ contact_email: "david@localazy.com",
34
+ cuisine: "Thai",
35
+ featured_image: null,
36
+ };
37
+
38
+ expect(populatedEntry).toEqual(expected);
39
+ });
40
+
41
+ it("should populate a 'restaurant-simple-flat' with media correctly", async () => {
42
+ const populatedEntry = await populateCreateUpdateEntryWithBaseEntry(
43
+ allModels,
44
+ simpleFlatWithMediaModel.updateEntry,
45
+ simpleFlatWithMediaModel.baseEntry,
46
+ simpleFlatWithMediaModel.fullyPopulatedLocalizedEntry,
47
+ simpleFlatWithMediaModel.uid,
48
+ simpleFlatWithMediaModel.locale,
49
+ );
50
+
51
+ const expected = {
52
+ id: 52,
53
+ name: "Michelin",
54
+ description: "Najbardziej wyszukana restauracja w Układzie Słonecznym. Sprawdź nasze menu stworzone przez jedynego Gordona Ramsaya.",
55
+ established_at: "2002-06-23",
56
+ is_franchise: true,
57
+ contact_email: "david@localazy.com",
58
+ cuisine: "French",
59
+ featured_image: {
60
+ id: 1,
61
+ name: "jason-leung-poI7DelFiVA-unsplash.jpg",
62
+ alternativeText: "jason-leung-poI7DelFiVA-unsplash.jpg",
63
+ caption: "jason-leung-poI7DelFiVA-unsplash.jpg",
64
+ width: 5596,
65
+ height: 3731,
66
+ formats: {
67
+ thumbnail: {
68
+ name: "thumbnail_jason-leung-poI7DelFiVA-unsplash.jpg",
69
+ hash: "thumbnail_jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b",
70
+ ext: ".jpg",
71
+ mime: "image/jpeg",
72
+ path: null,
73
+ width: 234,
74
+ height: 156,
75
+ size: 11.74,
76
+ url: "/uploads/thumbnail_jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b.jpg",
77
+ },
78
+ large: {
79
+ name: "large_jason-leung-poI7DelFiVA-unsplash.jpg",
80
+ hash: "large_jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b",
81
+ ext: ".jpg",
82
+ mime: "image/jpeg",
83
+ path: null,
84
+ width: 1000,
85
+ height: 666,
86
+ size: 140.2,
87
+ url: "/uploads/large_jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b.jpg",
88
+ },
89
+ medium: {
90
+ name: "medium_jason-leung-poI7DelFiVA-unsplash.jpg",
91
+ hash: "medium_jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b",
92
+ ext: ".jpg",
93
+ mime: "image/jpeg",
94
+ path: null,
95
+ width: 750,
96
+ height: 500,
97
+ size: 86.32,
98
+ url: "/uploads/medium_jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b.jpg",
99
+ },
100
+ small: {
101
+ name: "small_jason-leung-poI7DelFiVA-unsplash.jpg",
102
+ hash: "small_jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b",
103
+ ext: ".jpg",
104
+ mime: "image/jpeg",
105
+ path: null,
106
+ width: 500,
107
+ height: 333,
108
+ size: 42.51,
109
+ url: "/uploads/small_jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b.jpg",
110
+ },
111
+ },
112
+ hash: "jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b",
113
+ ext: ".jpg",
114
+ mime: "image/jpeg",
115
+ size: 3461.64,
116
+ url: "/uploads/jason_leung_po_I7_Del_Fi_VA_unsplash_508d22c55b.jpg",
117
+ previewUrl: null,
118
+ provider: "local",
119
+ provider_metadata: null,
120
+ },
121
+ };
122
+
123
+ expect(populatedEntry).toEqual(expected);
124
+ });
125
+
126
+ // with menu
127
+ it("should populate a 'restaurant-simple-menu' with menu and media correctly", async () => {
128
+ const populatedEntry = await populateCreateUpdateEntryWithBaseEntry(
129
+ allModels,
130
+ simpleMenuWithMediaModel.updateEntry,
131
+ simpleMenuWithMediaModel.baseEntry,
132
+ simpleMenuWithMediaModel.fullyPopulatedLocalizedEntry,
133
+ simpleMenuWithMediaModel.uid,
134
+ simpleMenuWithMediaModel.locale,
135
+ );
136
+
137
+ const expected = {
138
+ id: 37,
139
+ name: "Głodne okno",
140
+ description: "Orientalne jedzenie uliczne w ustach szybko i łatwo!",
141
+ established_at: "2022-10-01",
142
+ is_franchise: false,
143
+ contact_email: "david@localazy.com",
144
+ cuisine: "Thai",
145
+ capacity: 68,
146
+ our_story: "Za nami jest więcej**! Sprawdź naszą historię na [Localazy] (https://localazy.com).\n\n! [Logo_sq-01.png] (/uploads/Logo_sq_01_08b9bb6be1.png)",
147
+ menu: [
148
+ {
149
+ id: 40,
150
+ name: "Zupa Curry",
151
+ price: 5,
152
+ currency: "$",
153
+ description: "_Super pyszna zupa. _\n\n<u>Ostrzeżenie: Ostre jak diabli! </u>",
154
+ is_available: true,
155
+ food_gallery: [
156
+ {
157
+ id: 3,
158
+ name: "emy-XoByiBymX20-unsplash.jpg",
159
+ alternativeText: "emy-XoByiBymX20-unsplash.jpg",
160
+ caption: "emy-XoByiBymX20-unsplash.jpg",
161
+ width: 5184,
162
+ height: 3456,
163
+ formats: {
164
+ thumbnail: {
165
+ name: "thumbnail_emy-XoByiBymX20-unsplash.jpg",
166
+ hash: "thumbnail_emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a",
167
+ ext: ".jpg",
168
+ mime: "image/jpeg",
169
+ path: null,
170
+ width: 234,
171
+ height: 156,
172
+ size: 11.04,
173
+ url: "/uploads/thumbnail_emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a.jpg",
174
+ },
175
+ large: {
176
+ name: "large_emy-XoByiBymX20-unsplash.jpg",
177
+ hash: "large_emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a",
178
+ ext: ".jpg",
179
+ mime: "image/jpeg",
180
+ path: null,
181
+ width: 1000,
182
+ height: 667,
183
+ size: 97.59,
184
+ url: "/uploads/large_emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a.jpg",
185
+ },
186
+ medium: {
187
+ name: "medium_emy-XoByiBymX20-unsplash.jpg",
188
+ hash: "medium_emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a",
189
+ ext: ".jpg",
190
+ mime: "image/jpeg",
191
+ path: null,
192
+ width: 750,
193
+ height: 500,
194
+ size: 63.15,
195
+ url: "/uploads/medium_emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a.jpg",
196
+ },
197
+ small: {
198
+ name: "small_emy-XoByiBymX20-unsplash.jpg",
199
+ hash: "small_emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a",
200
+ ext: ".jpg",
201
+ mime: "image/jpeg",
202
+ path: null,
203
+ width: 500,
204
+ height: 333,
205
+ size: 33.98,
206
+ url: "/uploads/small_emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a.jpg",
207
+ },
208
+ },
209
+ hash: "emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a",
210
+ ext: ".jpg",
211
+ mime: "image/jpeg",
212
+ size: 1411.68,
213
+ url: "/uploads/emy_Xo_Byi_Bym_X20_unsplash_a5d1373d3a.jpg",
214
+ previewUrl: null,
215
+ provider: "local",
216
+ provider_metadata: null,
217
+ },
218
+ {
219
+ id: 4,
220
+ name: "ting-tian-al9eh9QkdPA-unsplash.jpg",
221
+ alternativeText: "ting-tian-al9eh9QkdPA-unsplash.jpg",
222
+ caption: "ting-tian-al9eh9QkdPA-unsplash.jpg",
223
+ width: 3840,
224
+ height: 5760,
225
+ formats: {
226
+ thumbnail: {
227
+ name: "thumbnail_ting-tian-al9eh9QkdPA-unsplash.jpg",
228
+ hash: "thumbnail_ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85",
229
+ ext: ".jpg",
230
+ mime: "image/jpeg",
231
+ path: null,
232
+ width: 104,
233
+ height: 156,
234
+ size: 6.06,
235
+ url: "/uploads/thumbnail_ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85.jpg",
236
+ },
237
+ large: {
238
+ name: "large_ting-tian-al9eh9QkdPA-unsplash.jpg",
239
+ hash: "large_ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85",
240
+ ext: ".jpg",
241
+ mime: "image/jpeg",
242
+ path: null,
243
+ width: 667,
244
+ height: 1000,
245
+ size: 202.98,
246
+ url: "/uploads/large_ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85.jpg",
247
+ },
248
+ medium: {
249
+ name: "medium_ting-tian-al9eh9QkdPA-unsplash.jpg",
250
+ hash: "medium_ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85",
251
+ ext: ".jpg",
252
+ mime: "image/jpeg",
253
+ path: null,
254
+ width: 500,
255
+ height: 750,
256
+ size: 120.06,
257
+ url: "/uploads/medium_ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85.jpg",
258
+ },
259
+ small: {
260
+ name: "small_ting-tian-al9eh9QkdPA-unsplash.jpg",
261
+ hash: "small_ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85",
262
+ ext: ".jpg",
263
+ mime: "image/jpeg",
264
+ path: null,
265
+ width: 333,
266
+ height: 500,
267
+ size: 54.32,
268
+ url: "/uploads/small_ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85.jpg",
269
+ },
270
+ },
271
+ hash: "ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85",
272
+ ext: ".jpg",
273
+ mime: "image/jpeg",
274
+ size: 5952.03,
275
+ url: "/uploads/ting_tian_al9eh9_Qkd_PA_unsplash_d5132e8a85.jpg",
276
+ previewUrl: null,
277
+ provider: "local",
278
+ provider_metadata: null,
279
+ },
280
+ ],
281
+ },
282
+ ],
283
+ featured_image: null,
284
+ };
285
+
286
+ expect(populatedEntry).toEqual(expected);
287
+ });
288
+
289
+ it("should populate a 'restaurant-simple-menu' without menu correctly", async () => {
290
+ const populatedEntry = await populateCreateUpdateEntryWithBaseEntry(
291
+ allModels,
292
+ simpleMenuEmptyModel.updateEntry,
293
+ simpleMenuEmptyModel.baseEntry,
294
+ simpleMenuEmptyModel.fullyPopulatedLocalizedEntry,
295
+ simpleMenuEmptyModel.uid,
296
+ simpleMenuEmptyModel.locale,
297
+ );
298
+
299
+ const expected = {
300
+ id: 39,
301
+ name: "Niebieska ostryga",
302
+ description: "Widzisz jedzenie? Lepiej powiedzmy, że owoce morza!",
303
+ established_at: "1822-07-09",
304
+ is_franchise: null,
305
+ contact_email: "david@localazy.com",
306
+ cuisine: "Italian",
307
+ capacity: 16,
308
+ our_story: "Długa tradycja, mądrość przekazywana z pokolenia na pokolenie... Od 1822 roku.",
309
+ menu: [
310
+ ],
311
+ featured_image: null,
312
+ };
313
+
314
+ expect(populatedEntry).toEqual(expected);
315
+ });
316
+
317
+ it("should populate a 'sample-json' correctly", async () => {
318
+ const populatedEntry = await populateCreateUpdateEntryWithBaseEntry(
319
+ allModels,
320
+ sampleJSONModel.updateEntry,
321
+ sampleJSONModel.baseEntry,
322
+ sampleJSONModel.fullyPopulatedLocalizedEntry,
323
+ sampleJSONModel.uid,
324
+ sampleJSONModel.locale,
325
+ );
326
+
327
+ const expected = {
328
+ id: 17,
329
+ purpose: "Foo CZ",
330
+ data: {
331
+ foo: "bar",
332
+ bar: {
333
+ foo: "baz",
334
+ },
335
+ },
336
+ };
337
+
338
+ expect(populatedEntry).toEqual(expected);
339
+ });
340
+
341
+ it("should populate a 'cookbook' correctly", async () => {
342
+ const populatedEntry = await populateCreateUpdateEntryWithBaseEntry(
343
+ allModels,
344
+ cookbookModel.updateEntry,
345
+ cookbookModel.baseEntry,
346
+ cookbookModel.fullyPopulatedLocalizedEntry,
347
+ cookbookModel.uid,
348
+ cookbookModel.locale,
349
+ );
350
+
351
+ const expected = {
352
+ id: 24,
353
+ title: "Pro každý den v roce",
354
+ author_name: "David V.",
355
+ pages: 365,
356
+ recipes: [
357
+ {
358
+ id: 20,
359
+ name: "Bramborový salát",
360
+ recipe: "Oloupejte brambory, smíchejte je se všemi ingrediencemi a máte hotovo. Bon apetit!",
361
+ estimated_cook_time: "00:30:00.000",
362
+ difficulty: "easy",
363
+ author_name: "Mr. Bramborová hlava",
364
+ gallery: [
365
+ {
366
+ id: 100,
367
+ image_title: "Syrové brambory",
368
+ image_description: "Čerstvý!",
369
+ image: {
370
+ id: 6,
371
+ name: "rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
372
+ alternativeText: "rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
373
+ caption: "rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
374
+ width: 2268,
375
+ height: 4032,
376
+ formats: {
377
+ thumbnail: {
378
+ name: "thumbnail_rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
379
+ hash: "thumbnail_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
380
+ ext: ".jpg",
381
+ mime: "image/jpeg",
382
+ path: null,
383
+ width: 88,
384
+ height: 156,
385
+ size: 5.35,
386
+ url: "/uploads/thumbnail_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
387
+ },
388
+ large: {
389
+ name: "large_rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
390
+ hash: "large_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
391
+ ext: ".jpg",
392
+ mime: "image/jpeg",
393
+ path: null,
394
+ width: 563,
395
+ height: 1000,
396
+ size: 108.15,
397
+ url: "/uploads/large_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
398
+ },
399
+ medium: {
400
+ name: "medium_rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
401
+ hash: "medium_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
402
+ ext: ".jpg",
403
+ mime: "image/jpeg",
404
+ path: null,
405
+ width: 422,
406
+ height: 750,
407
+ size: 65.52,
408
+ url: "/uploads/medium_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
409
+ },
410
+ small: {
411
+ name: "small_rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
412
+ hash: "small_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
413
+ ext: ".jpg",
414
+ mime: "image/jpeg",
415
+ path: null,
416
+ width: 281,
417
+ height: 500,
418
+ size: 34.23,
419
+ url: "/uploads/small_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
420
+ },
421
+ },
422
+ hash: "rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
423
+ ext: ".jpg",
424
+ mime: "image/jpeg",
425
+ size: 1081.59,
426
+ url: "/uploads/rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
427
+ previewUrl: null,
428
+ provider: "local",
429
+ provider_metadata: null,
430
+ },
431
+ },
432
+ {
433
+ id: 101,
434
+ image_title: "Salát",
435
+ image_description: "Mňam!",
436
+ image: {
437
+ id: 7,
438
+ name: "jeffrey-betts-PeyzQt7tMk0-unsplash.jpg",
439
+ alternativeText: "jeffrey-betts-PeyzQt7tMk0-unsplash.jpg",
440
+ caption: "jeffrey-betts-PeyzQt7tMk0-unsplash.jpg",
441
+ width: 4608,
442
+ height: 3456,
443
+ formats: {
444
+ thumbnail: {
445
+ name: "thumbnail_jeffrey-betts-PeyzQt7tMk0-unsplash.jpg",
446
+ hash: "thumbnail_jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db",
447
+ ext: ".jpg",
448
+ mime: "image/jpeg",
449
+ path: null,
450
+ width: 208,
451
+ height: 156,
452
+ size: 9.03,
453
+ url: "/uploads/thumbnail_jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db.jpg",
454
+ },
455
+ large: {
456
+ name: "large_jeffrey-betts-PeyzQt7tMk0-unsplash.jpg",
457
+ hash: "large_jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db",
458
+ ext: ".jpg",
459
+ mime: "image/jpeg",
460
+ path: null,
461
+ width: 1000,
462
+ height: 750,
463
+ size: 102.77,
464
+ url: "/uploads/large_jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db.jpg",
465
+ },
466
+ medium: {
467
+ name: "medium_jeffrey-betts-PeyzQt7tMk0-unsplash.jpg",
468
+ hash: "medium_jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db",
469
+ ext: ".jpg",
470
+ mime: "image/jpeg",
471
+ path: null,
472
+ width: 750,
473
+ height: 563,
474
+ size: 66.26,
475
+ url: "/uploads/medium_jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db.jpg",
476
+ },
477
+ small: {
478
+ name: "small_jeffrey-betts-PeyzQt7tMk0-unsplash.jpg",
479
+ hash: "small_jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db",
480
+ ext: ".jpg",
481
+ mime: "image/jpeg",
482
+ path: null,
483
+ width: 500,
484
+ height: 375,
485
+ size: 35.17,
486
+ url: "/uploads/small_jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db.jpg",
487
+ },
488
+ },
489
+ hash: "jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db",
490
+ ext: ".jpg",
491
+ mime: "image/jpeg",
492
+ size: 1664.79,
493
+ url: "/uploads/jeffrey_betts_Peyz_Qt7t_Mk0_unsplash_9650d628db.jpg",
494
+ previewUrl: null,
495
+ provider: "local",
496
+ provider_metadata: null,
497
+ },
498
+ },
499
+ ],
500
+ ingredients: [
501
+ {
502
+ id: 115,
503
+ name: "Brambory",
504
+ amount: 2,
505
+ unit: "kg",
506
+ is_required: true,
507
+ },
508
+ {
509
+ id: 116,
510
+ name: "Hrášek",
511
+ amount: 0.5,
512
+ unit: "plechovka",
513
+ is_required: true,
514
+ },
515
+ {
516
+ id: 117,
517
+ name: "Kukuřice",
518
+ amount: 0.5,
519
+ unit: "plechovka",
520
+ is_required: true,
521
+ },
522
+ {
523
+ id: 118,
524
+ name: "Majonéza",
525
+ amount: 4,
526
+ unit: "1",
527
+ is_required: true,
528
+ },
529
+ {
530
+ id: 119,
531
+ name: "Sýr",
532
+ amount: 1,
533
+ unit: "1",
534
+ is_required: true,
535
+ },
536
+ {
537
+ id: 120,
538
+ name: "Jablko",
539
+ amount: 1,
540
+ unit: "ks",
541
+ is_required: true,
542
+ },
543
+ ],
544
+ },
545
+ ],
546
+ gallery: {
547
+ id: 24,
548
+ optional_title: null,
549
+ annotation: "Podívejte se na naše chutné jídlo, pak čtěte dál a ponořte se do kulinářského nebe!",
550
+ main_image: {
551
+ id: 102,
552
+ image_title: "Kuchařka",
553
+ image_description: "Booklet",
554
+ image: {
555
+ id: 9,
556
+ name: "dan-gold-5O1ddenSM4g-unsplash.jpg",
557
+ alternativeText: "dan-gold-5O1ddenSM4g-unsplash.jpg",
558
+ caption: "dan-gold-5O1ddenSM4g-unsplash.jpg",
559
+ width: 6000,
560
+ height: 3376,
561
+ formats: {
562
+ thumbnail: {
563
+ name: "thumbnail_dan-gold-5O1ddenSM4g-unsplash.jpg",
564
+ hash: "thumbnail_dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907",
565
+ ext: ".jpg",
566
+ mime: "image/jpeg",
567
+ path: null,
568
+ width: 245,
569
+ height: 138,
570
+ size: 7.44,
571
+ url: "/uploads/thumbnail_dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907.jpg",
572
+ },
573
+ large: {
574
+ name: "large_dan-gold-5O1ddenSM4g-unsplash.jpg",
575
+ hash: "large_dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907",
576
+ ext: ".jpg",
577
+ mime: "image/jpeg",
578
+ path: null,
579
+ width: 1000,
580
+ height: 563,
581
+ size: 52.67,
582
+ url: "/uploads/large_dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907.jpg",
583
+ },
584
+ medium: {
585
+ name: "medium_dan-gold-5O1ddenSM4g-unsplash.jpg",
586
+ hash: "medium_dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907",
587
+ ext: ".jpg",
588
+ mime: "image/jpeg",
589
+ path: null,
590
+ width: 750,
591
+ height: 422,
592
+ size: 35.15,
593
+ url: "/uploads/medium_dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907.jpg",
594
+ },
595
+ small: {
596
+ name: "small_dan-gold-5O1ddenSM4g-unsplash.jpg",
597
+ hash: "small_dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907",
598
+ ext: ".jpg",
599
+ mime: "image/jpeg",
600
+ path: null,
601
+ width: 500,
602
+ height: 281,
603
+ size: 19.95,
604
+ url: "/uploads/small_dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907.jpg",
605
+ },
606
+ },
607
+ hash: "dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907",
608
+ ext: ".jpg",
609
+ mime: "image/jpeg",
610
+ size: 972.68,
611
+ url: "/uploads/dan_gold_5_O1dden_SM_4g_unsplash_5adef7d907.jpg",
612
+ previewUrl: null,
613
+ provider: "local",
614
+ provider_metadata: null,
615
+ },
616
+ },
617
+ gallery: [
618
+ {
619
+ id: 103,
620
+ image_title: null,
621
+ image_description: "Brožura, listy a vidlička.",
622
+ image: {
623
+ id: 11,
624
+ name: "heather-ford-G4LFhuLXhLE-unsplash.jpg",
625
+ alternativeText: "heather-ford-G4LFhuLXhLE-unsplash.jpg",
626
+ caption: "heather-ford-G4LFhuLXhLE-unsplash.jpg",
627
+ width: 6127,
628
+ height: 3844,
629
+ formats: {
630
+ thumbnail: {
631
+ name: "thumbnail_heather-ford-G4LFhuLXhLE-unsplash.jpg",
632
+ hash: "thumbnail_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
633
+ ext: ".jpg",
634
+ mime: "image/jpeg",
635
+ path: null,
636
+ width: 245,
637
+ height: 154,
638
+ size: 9.54,
639
+ url: "/uploads/thumbnail_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
640
+ },
641
+ large: {
642
+ name: "large_heather-ford-G4LFhuLXhLE-unsplash.jpg",
643
+ hash: "large_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
644
+ ext: ".jpg",
645
+ mime: "image/jpeg",
646
+ path: null,
647
+ width: 1000,
648
+ height: 628,
649
+ size: 117.56,
650
+ url: "/uploads/large_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
651
+ },
652
+ medium: {
653
+ name: "medium_heather-ford-G4LFhuLXhLE-unsplash.jpg",
654
+ hash: "medium_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
655
+ ext: ".jpg",
656
+ mime: "image/jpeg",
657
+ path: null,
658
+ width: 750,
659
+ height: 471,
660
+ size: 66.32,
661
+ url: "/uploads/medium_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
662
+ },
663
+ small: {
664
+ name: "small_heather-ford-G4LFhuLXhLE-unsplash.jpg",
665
+ hash: "small_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
666
+ ext: ".jpg",
667
+ mime: "image/jpeg",
668
+ path: null,
669
+ width: 500,
670
+ height: 314,
671
+ size: 31.42,
672
+ url: "/uploads/small_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
673
+ },
674
+ },
675
+ hash: "heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
676
+ ext: ".jpg",
677
+ mime: "image/jpeg",
678
+ size: 6971.47,
679
+ url: "/uploads/heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
680
+ previewUrl: null,
681
+ provider: "local",
682
+ provider_metadata: null,
683
+ },
684
+ },
685
+ {
686
+ id: 104,
687
+ image_title: "Koření",
688
+ image_description: null,
689
+ image: {
690
+ id: 10,
691
+ name: "calum-lewis-vA1L1jRTM70-unsplash.jpg",
692
+ alternativeText: "calum-lewis-vA1L1jRTM70-unsplash.jpg",
693
+ caption: "calum-lewis-vA1L1jRTM70-unsplash.jpg",
694
+ width: 3569,
695
+ height: 5353,
696
+ formats: {
697
+ thumbnail: {
698
+ name: "thumbnail_calum-lewis-vA1L1jRTM70-unsplash.jpg",
699
+ hash: "thumbnail_calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997",
700
+ ext: ".jpg",
701
+ mime: "image/jpeg",
702
+ path: null,
703
+ width: 104,
704
+ height: 156,
705
+ size: 5.55,
706
+ url: "/uploads/thumbnail_calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997.jpg",
707
+ },
708
+ large: {
709
+ name: "large_calum-lewis-vA1L1jRTM70-unsplash.jpg",
710
+ hash: "large_calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997",
711
+ ext: ".jpg",
712
+ mime: "image/jpeg",
713
+ path: null,
714
+ width: 667,
715
+ height: 1000,
716
+ size: 116.32,
717
+ url: "/uploads/large_calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997.jpg",
718
+ },
719
+ medium: {
720
+ name: "medium_calum-lewis-vA1L1jRTM70-unsplash.jpg",
721
+ hash: "medium_calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997",
722
+ ext: ".jpg",
723
+ mime: "image/jpeg",
724
+ path: null,
725
+ width: 500,
726
+ height: 750,
727
+ size: 72.75,
728
+ url: "/uploads/medium_calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997.jpg",
729
+ },
730
+ small: {
731
+ name: "small_calum-lewis-vA1L1jRTM70-unsplash.jpg",
732
+ hash: "small_calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997",
733
+ ext: ".jpg",
734
+ mime: "image/jpeg",
735
+ path: null,
736
+ width: 333,
737
+ height: 500,
738
+ size: 36.52,
739
+ url: "/uploads/small_calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997.jpg",
740
+ },
741
+ },
742
+ hash: "calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997",
743
+ ext: ".jpg",
744
+ mime: "image/jpeg",
745
+ size: 2305.97,
746
+ url: "/uploads/calum_lewis_v_A1_L1j_RTM_70_unsplash_5aff3a8997.jpg",
747
+ previewUrl: null,
748
+ provider: "local",
749
+ provider_metadata: null,
750
+ },
751
+ },
752
+ ],
753
+ },
754
+ };
755
+
756
+ expect(populatedEntry).toEqual(expected);
757
+ });
758
+
759
+ it("should populate a 'cookbook' without recipes correctly", async () => {
760
+ const populatedEntry = await populateCreateUpdateEntryWithBaseEntry(
761
+ allModels,
762
+ cookbookEmptyRecipesModel.updateEntry,
763
+ cookbookEmptyRecipesModel.baseEntry,
764
+ cookbookEmptyRecipesModel.fullyPopulatedLocalizedEntry,
765
+ cookbookEmptyRecipesModel.uid,
766
+ cookbookEmptyRecipesModel.locale,
767
+ );
768
+
769
+ const expected = {
770
+ id: 34,
771
+ title: "Jedna cholernie pusta książka kucharska",
772
+ author_name: "Jamie Oliver",
773
+ pages: 0,
774
+ recipes: [
775
+ ],
776
+ gallery: {
777
+ id: 34,
778
+ optional_title: "Jamie's cookbook",
779
+ annotation: "Zupełnie nowy, zawiera zero przepisów. Stwórz własne!",
780
+ main_image: {
781
+ id: 140,
782
+ image_title: "Knajpa",
783
+ image_description: "Pub",
784
+ image: {
785
+ id: 12,
786
+ name: "rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
787
+ alternativeText: "rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
788
+ caption: "rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
789
+ width: 2839,
790
+ height: 3785,
791
+ formats: {
792
+ thumbnail: {
793
+ name: "thumbnail_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
794
+ hash: "thumbnail_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
795
+ ext: ".jpg",
796
+ mime: "image/jpeg",
797
+ path: null,
798
+ width: 117,
799
+ height: 156,
800
+ size: 5.26,
801
+ url: "/uploads/thumbnail_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
802
+ },
803
+ large: {
804
+ name: "large_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
805
+ hash: "large_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
806
+ ext: ".jpg",
807
+ mime: "image/jpeg",
808
+ path: null,
809
+ width: 750,
810
+ height: 1000,
811
+ size: 114.8,
812
+ url: "/uploads/large_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
813
+ },
814
+ medium: {
815
+ name: "medium_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
816
+ hash: "medium_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
817
+ ext: ".jpg",
818
+ mime: "image/jpeg",
819
+ path: null,
820
+ width: 562,
821
+ height: 750,
822
+ size: 69.07,
823
+ url: "/uploads/medium_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
824
+ },
825
+ small: {
826
+ name: "small_rishabh-modi-ubEMIKHv9Jk-unsplash.jpg",
827
+ hash: "small_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
828
+ ext: ".jpg",
829
+ mime: "image/jpeg",
830
+ path: null,
831
+ width: 375,
832
+ height: 500,
833
+ size: 35.47,
834
+ url: "/uploads/small_rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
835
+ },
836
+ },
837
+ hash: "rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28",
838
+ ext: ".jpg",
839
+ mime: "image/jpeg",
840
+ size: 1736.7,
841
+ url: "/uploads/rishabh_modi_ub_EMIK_Hv9_Jk_unsplash_68bba86c28.jpg",
842
+ previewUrl: null,
843
+ provider: "local",
844
+ provider_metadata: null,
845
+ },
846
+ },
847
+ gallery: [
848
+ ],
849
+ },
850
+ };
851
+
852
+ expect(populatedEntry).toEqual(expected);
853
+ });
854
+
855
+ it("should populate a 'sample-json' including DZs correctly", async () => {
856
+ const populatedEntry = await populateCreateUpdateEntryWithBaseEntry(
857
+ allModels,
858
+ sampleJSONWithDZsModel.updateEntry,
859
+ sampleJSONWithDZsModel.baseEntry,
860
+ sampleJSONWithDZsModel.fullyPopulatedLocalizedEntry,
861
+ sampleJSONWithDZsModel.uid,
862
+ sampleJSONWithDZsModel.locale,
863
+ );
864
+
865
+ const expected = {
866
+ id: 24,
867
+ purpose: "Bar",
868
+ data: {
869
+ bar: "baz",
870
+ },
871
+ dynamic_property: [
872
+ {
873
+ id: 170,
874
+ image_title: "Nějaký název obrázku",
875
+ image_description: "Nějaký popis obrázku",
876
+ image: {
877
+ id: 11,
878
+ name: "heather-ford-G4LFhuLXhLE-unsplash.jpg",
879
+ alternativeText: "heather-ford-G4LFhuLXhLE-unsplash.jpg",
880
+ caption: "heather-ford-G4LFhuLXhLE-unsplash.jpg",
881
+ width: 6127,
882
+ height: 3844,
883
+ formats: {
884
+ thumbnail: {
885
+ name: "thumbnail_heather-ford-G4LFhuLXhLE-unsplash.jpg",
886
+ hash: "thumbnail_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
887
+ ext: ".jpg",
888
+ mime: "image/jpeg",
889
+ path: null,
890
+ width: 245,
891
+ height: 154,
892
+ size: 9.54,
893
+ url: "/uploads/thumbnail_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
894
+ },
895
+ large: {
896
+ name: "large_heather-ford-G4LFhuLXhLE-unsplash.jpg",
897
+ hash: "large_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
898
+ ext: ".jpg",
899
+ mime: "image/jpeg",
900
+ path: null,
901
+ width: 1000,
902
+ height: 628,
903
+ size: 117.56,
904
+ url: "/uploads/large_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
905
+ },
906
+ medium: {
907
+ name: "medium_heather-ford-G4LFhuLXhLE-unsplash.jpg",
908
+ hash: "medium_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
909
+ ext: ".jpg",
910
+ mime: "image/jpeg",
911
+ path: null,
912
+ width: 750,
913
+ height: 471,
914
+ size: 66.32,
915
+ url: "/uploads/medium_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
916
+ },
917
+ small: {
918
+ name: "small_heather-ford-G4LFhuLXhLE-unsplash.jpg",
919
+ hash: "small_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
920
+ ext: ".jpg",
921
+ mime: "image/jpeg",
922
+ path: null,
923
+ width: 500,
924
+ height: 314,
925
+ size: 31.42,
926
+ url: "/uploads/small_heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
927
+ },
928
+ },
929
+ hash: "heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f",
930
+ ext: ".jpg",
931
+ mime: "image/jpeg",
932
+ size: 6971.47,
933
+ url: "/uploads/heather_ford_G4_L_Fhu_L_Xh_LE_unsplash_7a2c2cac8f.jpg",
934
+ previewUrl: null,
935
+ provider: "local",
936
+ provider_metadata: null,
937
+ },
938
+ __component: "food.gallery-item",
939
+ },
940
+ {
941
+ id: 191,
942
+ name: "Přísada I",
943
+ amount: null,
944
+ unit: null,
945
+ is_required: true,
946
+ __component: "food.recipe-ingredient",
947
+ },
948
+ {
949
+ id: 36,
950
+ name: "První položka CB",
951
+ recipe: null,
952
+ estimated_cook_time: "00:03:00.000",
953
+ difficulty: "beginner",
954
+ author_name: "Já",
955
+ gallery: [
956
+ {
957
+ id: 171,
958
+ image_title: "Obrázek G Jedna",
959
+ image_description: "Obrázek G Popis Jedna",
960
+ },
961
+ {
962
+ id: 172,
963
+ image_title: "Img G Two",
964
+ image_description: "Img G Desc Two",
965
+ },
966
+ ],
967
+ ingredients: [
968
+ {
969
+ id: 193,
970
+ name: "První Ingr DZ",
971
+ amount: null,
972
+ unit: null,
973
+ is_required: true,
974
+ },
975
+ ],
976
+ __component: "food.cookbook-item",
977
+ },
978
+ {
979
+ id: 192,
980
+ name: "Druhá přísada",
981
+ amount: null,
982
+ unit: null,
983
+ is_required: true,
984
+ __component: "food.recipe-ingredient",
985
+ },
986
+ ],
987
+ repeatable_component_property: [
988
+ {
989
+ id: 61,
990
+ name: "Položka 1",
991
+ price: 1,
992
+ currency: "CZK",
993
+ description: "Nějaký popis",
994
+ is_available: null,
995
+ food_gallery: null,
996
+ },
997
+ {
998
+ id: 62,
999
+ name: "Položka 2",
1000
+ price: 2,
1001
+ currency: "CZK",
1002
+ description: "Nějaký další popis",
1003
+ is_available: null,
1004
+ food_gallery: [
1005
+ {
1006
+ id: 6,
1007
+ name: "rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
1008
+ alternativeText: "rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
1009
+ caption: "rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
1010
+ width: 2268,
1011
+ height: 4032,
1012
+ formats: {
1013
+ thumbnail: {
1014
+ name: "thumbnail_rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
1015
+ hash: "thumbnail_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
1016
+ ext: ".jpg",
1017
+ mime: "image/jpeg",
1018
+ path: null,
1019
+ width: 88,
1020
+ height: 156,
1021
+ size: 5.35,
1022
+ url: "/uploads/thumbnail_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
1023
+ },
1024
+ large: {
1025
+ name: "large_rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
1026
+ hash: "large_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
1027
+ ext: ".jpg",
1028
+ mime: "image/jpeg",
1029
+ path: null,
1030
+ width: 563,
1031
+ height: 1000,
1032
+ size: 108.15,
1033
+ url: "/uploads/large_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
1034
+ },
1035
+ medium: {
1036
+ name: "medium_rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
1037
+ hash: "medium_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
1038
+ ext: ".jpg",
1039
+ mime: "image/jpeg",
1040
+ path: null,
1041
+ width: 422,
1042
+ height: 750,
1043
+ size: 65.52,
1044
+ url: "/uploads/medium_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
1045
+ },
1046
+ small: {
1047
+ name: "small_rodrigo-dos-reis-h3AkzboxK4Q-unsplash.jpg",
1048
+ hash: "small_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
1049
+ ext: ".jpg",
1050
+ mime: "image/jpeg",
1051
+ path: null,
1052
+ width: 281,
1053
+ height: 500,
1054
+ size: 34.23,
1055
+ url: "/uploads/small_rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
1056
+ },
1057
+ },
1058
+ hash: "rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea",
1059
+ ext: ".jpg",
1060
+ mime: "image/jpeg",
1061
+ size: 1081.59,
1062
+ url: "/uploads/rodrigo_dos_reis_h3_Akzbox_K4_Q_unsplash_d17e795cea.jpg",
1063
+ previewUrl: null,
1064
+ provider: "local",
1065
+ provider_metadata: null,
1066
+ },
1067
+ ],
1068
+ },
1069
+ ],
1070
+ };
1071
+
1072
+ expect(populatedEntry).toEqual(expected);
1073
+ });
1074
+
1075
+ it("should populate a 'lesson' including DZs correctly", async () => {
1076
+ const populatedEntry = await populateCreateUpdateEntryWithBaseEntry(
1077
+ allModels,
1078
+ lessonWithDZsModel.updateEntry,
1079
+ lessonWithDZsModel.baseEntry,
1080
+ lessonWithDZsModel.fullyPopulatedLocalizedEntry,
1081
+ lessonWithDZsModel.uid,
1082
+ lessonWithDZsModel.locale,
1083
+ );
1084
+
1085
+ const expected = {
1086
+ id: 4,
1087
+ title: "Test: Sčítání",
1088
+ start_time: "2022-10-01T13:00:00.000Z",
1089
+ duration: "02:00:00.000",
1090
+ description: "Otestujte si své dovednosti, které jsme se naučili v předchozí lekci.",
1091
+ lesson_type: [
1092
+ {
1093
+ id: 2,
1094
+ title: "Vyberte správnou odpověď",
1095
+ questions: [
1096
+ {
1097
+ id: 4,
1098
+ question: "1 + 1 = ",
1099
+ is_active: true,
1100
+ question_number: 1,
1101
+ },
1102
+ {
1103
+ id: 5,
1104
+ question: "5 + 15 = ",
1105
+ is_active: false,
1106
+ question_number: 2,
1107
+ },
1108
+ {
1109
+ id: 6,
1110
+ question: "Kolik pohárů je na fotce?",
1111
+ is_active: false,
1112
+ question_number: 3,
1113
+ },
1114
+ ],
1115
+ answers: [
1116
+ {
1117
+ id: 4,
1118
+ question_number: 1,
1119
+ correct_answer: "2",
1120
+ },
1121
+ {
1122
+ id: 5,
1123
+ question_number: 2,
1124
+ correct_answer: "20",
1125
+ },
1126
+ {
1127
+ id: 6,
1128
+ question_number: 3,
1129
+ correct_answer: "15",
1130
+ },
1131
+ ],
1132
+ __component: "lesson.quiz",
1133
+ },
1134
+ ],
1135
+ };
1136
+
1137
+ expect(populatedEntry).toEqual(expected);
1138
+ });
1139
+ });