@raketa-cloud/admin 0.0.79 → 0.0.82

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 (38) hide show
  1. package/package.json +1 -1
  2. package/src/cloud/ArticleRevisions.js +30 -0
  3. package/src/cloud/EventRevisions.js +30 -0
  4. package/src/cloud/PageRevisions.js +30 -0
  5. package/src/cloud/documents/articlesDocuments.js +24 -0
  6. package/src/cloud/documents/common.js +13 -0
  7. package/src/cloud/documents/eventsDocuments.js +24 -0
  8. package/src/cloud/documents/pagesDocuments.js +24 -0
  9. package/src/handlers/article_revisions/CancelSchedulesHandler.js +26 -0
  10. package/src/handlers/article_revisions/PublishesHandler.js +39 -10
  11. package/src/handlers/article_revisions/UnlocksHandler.js +1 -1
  12. package/src/handlers/event_revisions/CancelSchedulesHandler.js +26 -0
  13. package/src/handlers/event_revisions/PublishesHandler.js +34 -7
  14. package/src/handlers/event_revisions/UnlocksHandler.js +3 -1
  15. package/src/handlers/page_revisions/CancelSchedulesHandler.js +26 -0
  16. package/src/handlers/page_revisions/PublishesHandler.js +34 -7
  17. package/src/handlers/page_revisions/UnlocksHandler.js +1 -1
  18. package/src/routeArticlesModule.js +12 -0
  19. package/src/routeEventsModule.js +12 -0
  20. package/src/routePagesModule.js +12 -0
  21. package/src/styles/application.css +1 -2
  22. package/src/tests/handlers/article_revisions/CancelScheduledHandler.test/create.test.js +90 -0
  23. package/src/tests/handlers/article_revisions/PublishesHandler.test/create.test.js +187 -2
  24. package/src/tests/handlers/article_revisions/UnlocksHandler.test/create.test.js +2 -2
  25. package/src/tests/handlers/event_revisions/CancelScheduledHandler.test/create.test.js +90 -0
  26. package/src/tests/handlers/event_revisions/PublishesHandler.test/create.test.js +187 -2
  27. package/src/tests/handlers/event_revisions/UnlocksHandler.test/create.test.js +2 -2
  28. package/src/tests/handlers/page_revisions/CancelScheduledHandler.test/create.test.js +86 -0
  29. package/src/tests/handlers/page_revisions/PublishesHandler.test/create.test.js +187 -2
  30. package/src/tests/handlers/page_revisions/UnlocksHandler.test/create.test.js +2 -2
  31. package/src/tests/support/factory.js +16 -0
  32. package/src/views/article_revisions/publishes/_form.ejs +4 -1
  33. package/src/views/articles/show.ejs +117 -4
  34. package/src/views/event_revisions/publishes/_form.ejs +4 -1
  35. package/src/views/events/show.ejs +117 -4
  36. package/src/views/layouts/application.ejs +15 -0
  37. package/src/views/page_revisions/publishes/_form.ejs +4 -1
  38. package/src/views/pages/show.ejs +117 -4
@@ -17,6 +17,7 @@ import URLsHandler from "./handlers/pages/URLsHandler";
17
17
  import routeCollection from "./routeCollection";
18
18
  import routeNestedCollection from "./routeNestedCollection";
19
19
  import routeNestedMember from "./routeNestedMember";
20
+ import CancelSchedulesHandler from "./handlers/page_revisions/CancelSchedulesHandler";
20
21
 
21
22
  function routePagesModule(
22
23
  adapter,
@@ -133,6 +134,17 @@ function routePagesModule(
133
134
  }
134
135
  );
135
136
 
137
+ routeNestedCollection(
138
+ adapter,
139
+ revisionsBaseResource,
140
+ "cancel_schedules",
141
+ CancelSchedulesHandler,
142
+ {
143
+ ...resourceConfig,
144
+ viewsFallback: "page_revisions/cancel_schedules",
145
+ }
146
+ );
147
+
136
148
  routeNestedMember(
137
149
  adapter,
138
150
  `api/${revisionsBaseResource}`,
@@ -30,7 +30,6 @@ body {
30
30
  }
31
31
 
32
32
  @layer components {
33
-
34
33
  /* Utils */
35
34
  .dbg {
36
35
  @apply outline-1 outline-dashed outline-red-500;
@@ -289,7 +288,7 @@ body {
289
288
  .pagination {
290
289
  @apply text-center py-8 text-raketa-foreground/50;
291
290
 
292
- &>div {
291
+ & > div {
293
292
  @apply inline-flex items-center gap-4;
294
293
  }
295
294
 
@@ -0,0 +1,90 @@
1
+ import Factory from "../../../support/factory";
2
+ import ArticleRevisions from "../../../../cloud/ArticleRevisions";
3
+ import CancelSchedulesHandler from "../../../../handlers/article_revisions/CancelSchedulesHandler";
4
+
5
+ function buildCtx(revision) {
6
+ return {
7
+ client: {
8
+ articleRevisions: new ArticleRevisions(() => ({}), "token"),
9
+ },
10
+ params: { parent_id: revision.id },
11
+ locale: "en",
12
+ resourceConfig: {
13
+ articleType: "article",
14
+ articleTypePlural: "articles",
15
+ },
16
+ };
17
+ }
18
+
19
+ describe("Article revision schedule cancel", () => {
20
+ test("cancel of schedule successful", async () => {
21
+ const revision = Factory.build("article_revision");
22
+ const ctx = buildCtx(revision);
23
+
24
+ const mockUnlock = jest
25
+ .spyOn(ctx.client.articleRevisions, "cancelSchedule")
26
+ .mockImplementation(() => ({
27
+ revision: revision,
28
+ errors: null,
29
+ articleErrors: null,
30
+ }));
31
+
32
+ const result = await CancelSchedulesHandler.create(ctx);
33
+
34
+ expect(mockUnlock).toHaveBeenCalledWith(revision.id, "en");
35
+
36
+ expect(result).toEqual({
37
+ redirect: `/en/articles/${revision.originalId}`,
38
+ });
39
+ });
40
+
41
+ test("unlock failed with errors", async () => {
42
+ const revision = Factory.build("article_revision");
43
+ const ctx = buildCtx(revision);
44
+ const errors = [
45
+ {
46
+ key: "generalError",
47
+ message: "Failed to cancel schedule for revision",
48
+ },
49
+ ];
50
+
51
+ const mockUnlock = jest
52
+ .spyOn(ctx.client.articleRevisions, "cancelSchedule")
53
+ .mockImplementation(() => ({
54
+ revision: null,
55
+ errors,
56
+ articleErrors: null,
57
+ }));
58
+
59
+ await expect(CancelSchedulesHandler.create(ctx)).rejects.toThrow(
60
+ `Failed to cancel schedule for revision: ${JSON.stringify(errors)}`
61
+ );
62
+
63
+ expect(mockUnlock).toHaveBeenCalledWith(revision.id, "en");
64
+ });
65
+
66
+ test("unlock failed with article errors", async () => {
67
+ const revision = Factory.build("article_revision");
68
+ const ctx = buildCtx(revision);
69
+ const articleErrors = [
70
+ {
71
+ key: "generalError",
72
+ message: "Failed to cancel schedule for revision",
73
+ },
74
+ ];
75
+
76
+ const mockUnlock = jest
77
+ .spyOn(ctx.client.articleRevisions, "cancelSchedule")
78
+ .mockImplementation(() => ({
79
+ revision: null,
80
+ errors: null,
81
+ articleErrors,
82
+ }));
83
+
84
+ await expect(CancelSchedulesHandler.create(ctx)).rejects.toThrow(
85
+ `Failed to cancel schedule for revision: ${JSON.stringify(articleErrors)}`
86
+ );
87
+
88
+ expect(mockUnlock).toHaveBeenCalledWith(revision.id, "en");
89
+ });
90
+ });
@@ -21,7 +21,7 @@ function buildCtx(revision, resourceParams) {
21
21
  }
22
22
 
23
23
  describe("Publish article revision", () => {
24
- test("create successful", async () => {
24
+ test("create successful for publishing", async () => {
25
25
  const revision = Factory.build("article_revision");
26
26
  const publishing = {
27
27
  title: "A new revision!",
@@ -80,7 +80,7 @@ describe("Publish article revision", () => {
80
80
  });
81
81
  });
82
82
 
83
- test("create failed", async () => {
83
+ test("create failed for publishing", async () => {
84
84
  const revision = Factory.build("article_revision");
85
85
  const publishing = {
86
86
  title: "A new revision!",
@@ -133,6 +133,191 @@ describe("Publish article revision", () => {
133
133
  errors: {
134
134
  url: "Oops",
135
135
  },
136
+ articleErrors: null,
137
+ _translations: [],
138
+ },
139
+ });
140
+ });
141
+
142
+ test("create successful for scheduling", async () => {
143
+ const revision = Factory.build("article_revision");
144
+ const schedule = Factory.build("revision_schedule");
145
+ const publishing = {
146
+ mergeAt: "2024-12-20T20:20",
147
+ title: "A new revision!",
148
+ description: "Nice!",
149
+ visibility: "protected",
150
+ username: "admin",
151
+ password: "admin123!@#",
152
+ };
153
+
154
+ const ctx = buildCtx(revision, {
155
+ publishing,
156
+ });
157
+
158
+ const updatedRevision = { ...revision, schedule: { ...schedule } };
159
+
160
+ const mockFind = jest
161
+ .spyOn(ctx.client.articleRevisions, "find")
162
+ .mockImplementation(() => revision);
163
+
164
+ const mockSchedule = jest
165
+ .spyOn(ctx.client.articleRevisions, "schedule")
166
+ .mockImplementation(() => ({
167
+ revision: updatedRevision,
168
+ errors: null,
169
+ articleErrors: null,
170
+ }));
171
+
172
+ const result = await PublishesHandler.create(ctx);
173
+
174
+ expect(mockFind).toHaveBeenCalledWith(revision.id, "en");
175
+ expect(mockSchedule).toHaveBeenCalledWith(
176
+ revision.id,
177
+ "en",
178
+ {
179
+ title: publishing.title,
180
+ description: publishing.description,
181
+ mergeAt: "2024-12-20T20:20:00Z",
182
+ },
183
+ {
184
+ visibility: publishing.visibility,
185
+ settings: JSON.stringify({
186
+ ...revision.settings,
187
+ credentials: {
188
+ user: publishing.username,
189
+ password: publishing.password,
190
+ },
191
+ }),
192
+ }
193
+ );
194
+
195
+ expect(result).toEqual({
196
+ redirect: `/en/articles/${updatedRevision.originalId}`,
197
+ });
198
+ });
199
+
200
+ test("create failed for scheduling - articleErrors", async () => {
201
+ const revision = Factory.build("article_revision");
202
+ const publishing = {
203
+ mergeAt: "2024-12-20T20:20",
204
+ title: "A new revision!",
205
+ description: "Nice!",
206
+ visibility: "public",
207
+ };
208
+
209
+ const ctx = buildCtx(revision, {
210
+ publishing,
211
+ });
212
+
213
+ const mockFind = jest
214
+ .spyOn(ctx.client.articleRevisions, "find")
215
+ .mockImplementation(() => revision);
216
+
217
+ const mockSchedule = jest
218
+ .spyOn(ctx.client.articleRevisions, "schedule")
219
+ .mockImplementation(() => ({
220
+ revision: null,
221
+ articleErrors: [{ key: "slug", message: "Oops" }],
222
+ errors: null,
223
+ }));
224
+
225
+ const result = await PublishesHandler.create(ctx);
226
+
227
+ expect(mockFind).toHaveBeenCalledWith(revision.id, "en");
228
+ expect(mockSchedule).toHaveBeenCalledWith(
229
+ revision.id,
230
+ "en",
231
+ {
232
+ title: publishing.title,
233
+ description: publishing.description,
234
+ mergeAt: "2024-12-20T20:20:00Z",
235
+ },
236
+ {
237
+ visibility: publishing.visibility,
238
+ }
239
+ );
240
+
241
+ expect(result).toEqual({
242
+ assigns: {
243
+ publishing: {
244
+ id: revision.id,
245
+ originalId: revision.originalId,
246
+ title: publishing.title,
247
+ mergeAt: "2024-12-20T20:20",
248
+ description: publishing.description,
249
+ visibility: publishing.visibility,
250
+ username: publishing.username,
251
+ password: publishing.password,
252
+ },
253
+ visibilityOptions: ctx.client.articles.visibilityOptions(),
254
+ articleErrors: {
255
+ slug: "Oops",
256
+ },
257
+ errors: null,
258
+ _translations: [],
259
+ },
260
+ });
261
+ });
262
+
263
+ test("create failed for scheduling - errors", async () => {
264
+ const revision = Factory.build("article_revision");
265
+ const publishing = {
266
+ mergeAt: "2024-12-20T20:20",
267
+ title: "A new revision!",
268
+ description: "Nice!",
269
+ visibility: "public",
270
+ };
271
+
272
+ const ctx = buildCtx(revision, {
273
+ publishing,
274
+ });
275
+
276
+ const mockFind = jest
277
+ .spyOn(ctx.client.articleRevisions, "find")
278
+ .mockImplementation(() => revision);
279
+
280
+ const mockSchedule = jest
281
+ .spyOn(ctx.client.articleRevisions, "schedule")
282
+ .mockImplementation(() => ({
283
+ revision: null,
284
+ errors: [{ key: "slug", message: "Oops" }],
285
+ articleErrors: null,
286
+ }));
287
+
288
+ const result = await PublishesHandler.create(ctx);
289
+
290
+ expect(mockFind).toHaveBeenCalledWith(revision.id, "en");
291
+ expect(mockSchedule).toHaveBeenCalledWith(
292
+ revision.id,
293
+ "en",
294
+ {
295
+ title: publishing.title,
296
+ description: publishing.description,
297
+ mergeAt: "2024-12-20T20:20:00Z",
298
+ },
299
+ {
300
+ visibility: publishing.visibility,
301
+ }
302
+ );
303
+
304
+ expect(result).toEqual({
305
+ assigns: {
306
+ publishing: {
307
+ id: revision.id,
308
+ originalId: revision.originalId,
309
+ title: publishing.title,
310
+ mergeAt: "2024-12-20T20:20",
311
+ description: publishing.description,
312
+ visibility: publishing.visibility,
313
+ username: publishing.username,
314
+ password: publishing.password,
315
+ },
316
+ visibilityOptions: ctx.client.articles.visibilityOptions(),
317
+ errors: {
318
+ slug: "Oops",
319
+ },
320
+ articleErrors: null,
136
321
  _translations: [],
137
322
  },
138
323
  });
@@ -64,7 +64,7 @@ describe("Article revision unlock", () => {
64
64
  const revision = Factory.build("article_revision");
65
65
  const ctx = buildCtx(revision);
66
66
  const articleErrors = [
67
- { key: "generalError", message: "Failed to start revision" },
67
+ { key: "generalError", message: "Failed to unlock revision" },
68
68
  ];
69
69
 
70
70
  const mockUnlock = jest
@@ -76,7 +76,7 @@ describe("Article revision unlock", () => {
76
76
  }));
77
77
 
78
78
  await expect(UnlocksHandler.create(ctx)).rejects.toThrow(
79
- `Failed to start revision: ${JSON.stringify(articleErrors)}`
79
+ `Failed to unlock revision: ${JSON.stringify(articleErrors)}`
80
80
  );
81
81
 
82
82
  expect(mockUnlock).toHaveBeenCalledWith(revision.id, "en");
@@ -0,0 +1,90 @@
1
+ import Factory from "../../../support/factory";
2
+ import EventRevisions from "../../../../cloud/EventRevisions";
3
+ import CancelSchedulesHandler from "../../../../handlers/event_revisions/CancelSchedulesHandler";
4
+
5
+ function buildCtx(revision) {
6
+ return {
7
+ client: {
8
+ eventRevisions: new EventRevisions(() => ({}), "token"),
9
+ },
10
+ params: { parent_id: revision.id },
11
+ locale: "en",
12
+ resourceConfig: {
13
+ eventType: "event",
14
+ eventTypePlural: "events",
15
+ },
16
+ };
17
+ }
18
+
19
+ describe("Event revision schedule cancel", () => {
20
+ test("cancel of schedule successful", async () => {
21
+ const revision = Factory.build("event_revision");
22
+ const ctx = buildCtx(revision);
23
+
24
+ const mockUnlock = jest
25
+ .spyOn(ctx.client.eventRevisions, "cancelSchedule")
26
+ .mockImplementation(() => ({
27
+ revision: revision,
28
+ errors: null,
29
+ eventErrors: null,
30
+ }));
31
+
32
+ const result = await CancelSchedulesHandler.create(ctx);
33
+
34
+ expect(mockUnlock).toHaveBeenCalledWith(revision.id, "en");
35
+
36
+ expect(result).toEqual({
37
+ redirect: `/en/events/${revision.originalId}`,
38
+ });
39
+ });
40
+
41
+ test("unlock failed with errors", async () => {
42
+ const revision = Factory.build("event_revision");
43
+ const ctx = buildCtx(revision);
44
+ const errors = [
45
+ {
46
+ key: "generalError",
47
+ message: "Failed to cancel schedule for revision",
48
+ },
49
+ ];
50
+
51
+ const mockUnlock = jest
52
+ .spyOn(ctx.client.eventRevisions, "cancelSchedule")
53
+ .mockImplementation(() => ({
54
+ revision: null,
55
+ errors,
56
+ eventErrors: null,
57
+ }));
58
+
59
+ await expect(CancelSchedulesHandler.create(ctx)).rejects.toThrow(
60
+ `Failed to cancel schedule for revision: ${JSON.stringify(errors)}`
61
+ );
62
+
63
+ expect(mockUnlock).toHaveBeenCalledWith(revision.id, "en");
64
+ });
65
+
66
+ test("unlock failed with event errors", async () => {
67
+ const revision = Factory.build("event_revision");
68
+ const ctx = buildCtx(revision);
69
+ const eventErrors = [
70
+ {
71
+ key: "generalError",
72
+ message: "Failed to cancel schedule for revision",
73
+ },
74
+ ];
75
+
76
+ const mockUnlock = jest
77
+ .spyOn(ctx.client.eventRevisions, "cancelSchedule")
78
+ .mockImplementation(() => ({
79
+ revision: null,
80
+ errors: null,
81
+ eventErrors,
82
+ }));
83
+
84
+ await expect(CancelSchedulesHandler.create(ctx)).rejects.toThrow(
85
+ `Failed to cancel schedule for revision: ${JSON.stringify(eventErrors)}`
86
+ );
87
+
88
+ expect(mockUnlock).toHaveBeenCalledWith(revision.id, "en");
89
+ });
90
+ });
@@ -21,7 +21,7 @@ function buildCtx(revision, resourceParams) {
21
21
  }
22
22
 
23
23
  describe("Publish event revision", () => {
24
- test("create successful", async () => {
24
+ test("create successful for publishing", async () => {
25
25
  const revision = Factory.build("event_revision");
26
26
  const publishing = {
27
27
  title: "A new revision!",
@@ -80,7 +80,7 @@ describe("Publish event revision", () => {
80
80
  });
81
81
  });
82
82
 
83
- test("create failed", async () => {
83
+ test("create failed for publishing", async () => {
84
84
  const revision = Factory.build("event_revision");
85
85
  const publishing = {
86
86
  title: "A new revision!",
@@ -133,6 +133,191 @@ describe("Publish event revision", () => {
133
133
  errors: {
134
134
  url: "Oops",
135
135
  },
136
+ eventErrors: null,
137
+ _translations: [],
138
+ },
139
+ });
140
+ });
141
+
142
+ test("create successful for scheduling", async () => {
143
+ const revision = Factory.build("event_revision");
144
+ const schedule = Factory.build("revision_schedule");
145
+ const publishing = {
146
+ mergeAt: "2024-12-20T20:20",
147
+ title: "A new revision!",
148
+ description: "Nice!",
149
+ visibility: "protected",
150
+ username: "admin",
151
+ password: "admin123!@#",
152
+ };
153
+
154
+ const ctx = buildCtx(revision, {
155
+ publishing,
156
+ });
157
+
158
+ const updatedRevision = { ...revision, schedule: { ...schedule } };
159
+
160
+ const mockFind = jest
161
+ .spyOn(ctx.client.eventRevisions, "find")
162
+ .mockImplementation(() => revision);
163
+
164
+ const mockSchedule = jest
165
+ .spyOn(ctx.client.eventRevisions, "schedule")
166
+ .mockImplementation(() => ({
167
+ revision: updatedRevision,
168
+ errors: null,
169
+ eventErrors: null,
170
+ }));
171
+
172
+ const result = await PublishesHandler.create(ctx);
173
+
174
+ expect(mockFind).toHaveBeenCalledWith(revision.id, "en");
175
+ expect(mockSchedule).toHaveBeenCalledWith(
176
+ revision.id,
177
+ "en",
178
+ {
179
+ title: publishing.title,
180
+ description: publishing.description,
181
+ mergeAt: "2024-12-20T20:20:00Z",
182
+ },
183
+ {
184
+ visibility: publishing.visibility,
185
+ settings: JSON.stringify({
186
+ ...revision.settings,
187
+ credentials: {
188
+ user: publishing.username,
189
+ password: publishing.password,
190
+ },
191
+ }),
192
+ }
193
+ );
194
+
195
+ expect(result).toEqual({
196
+ redirect: `/en/events/${updatedRevision.originalId}`,
197
+ });
198
+ });
199
+
200
+ test("create failed for scheduling - eventErrors", async () => {
201
+ const revision = Factory.build("event_revision");
202
+ const publishing = {
203
+ mergeAt: "2024-12-20T20:20",
204
+ title: "A new revision!",
205
+ description: "Nice!",
206
+ visibility: "public",
207
+ };
208
+
209
+ const ctx = buildCtx(revision, {
210
+ publishing,
211
+ });
212
+
213
+ const mockFind = jest
214
+ .spyOn(ctx.client.eventRevisions, "find")
215
+ .mockImplementation(() => revision);
216
+
217
+ const mockSchedule = jest
218
+ .spyOn(ctx.client.eventRevisions, "schedule")
219
+ .mockImplementation(() => ({
220
+ revision: null,
221
+ eventErrors: [{ key: "slug", message: "Oops" }],
222
+ errors: null,
223
+ }));
224
+
225
+ const result = await PublishesHandler.create(ctx);
226
+
227
+ expect(mockFind).toHaveBeenCalledWith(revision.id, "en");
228
+ expect(mockSchedule).toHaveBeenCalledWith(
229
+ revision.id,
230
+ "en",
231
+ {
232
+ title: publishing.title,
233
+ description: publishing.description,
234
+ mergeAt: "2024-12-20T20:20:00Z",
235
+ },
236
+ {
237
+ visibility: publishing.visibility,
238
+ }
239
+ );
240
+
241
+ expect(result).toEqual({
242
+ assigns: {
243
+ publishing: {
244
+ id: revision.id,
245
+ originalId: revision.originalId,
246
+ title: publishing.title,
247
+ mergeAt: "2024-12-20T20:20",
248
+ description: publishing.description,
249
+ visibility: publishing.visibility,
250
+ username: publishing.username,
251
+ password: publishing.password,
252
+ },
253
+ visibilityOptions: ctx.client.events.visibilityOptions(),
254
+ eventErrors: {
255
+ slug: "Oops",
256
+ },
257
+ errors: null,
258
+ _translations: [],
259
+ },
260
+ });
261
+ });
262
+
263
+ test("create failed for scheduling - errors", async () => {
264
+ const revision = Factory.build("event_revision");
265
+ const publishing = {
266
+ mergeAt: "2024-12-20T20:20",
267
+ title: "A new revision!",
268
+ description: "Nice!",
269
+ visibility: "public",
270
+ };
271
+
272
+ const ctx = buildCtx(revision, {
273
+ publishing,
274
+ });
275
+
276
+ const mockFind = jest
277
+ .spyOn(ctx.client.eventRevisions, "find")
278
+ .mockImplementation(() => revision);
279
+
280
+ const mockSchedule = jest
281
+ .spyOn(ctx.client.eventRevisions, "schedule")
282
+ .mockImplementation(() => ({
283
+ revision: null,
284
+ errors: [{ key: "slug", message: "Oops" }],
285
+ eventErrors: null,
286
+ }));
287
+
288
+ const result = await PublishesHandler.create(ctx);
289
+
290
+ expect(mockFind).toHaveBeenCalledWith(revision.id, "en");
291
+ expect(mockSchedule).toHaveBeenCalledWith(
292
+ revision.id,
293
+ "en",
294
+ {
295
+ title: publishing.title,
296
+ description: publishing.description,
297
+ mergeAt: "2024-12-20T20:20:00Z",
298
+ },
299
+ {
300
+ visibility: publishing.visibility,
301
+ }
302
+ );
303
+
304
+ expect(result).toEqual({
305
+ assigns: {
306
+ publishing: {
307
+ id: revision.id,
308
+ originalId: revision.originalId,
309
+ title: publishing.title,
310
+ mergeAt: "2024-12-20T20:20",
311
+ description: publishing.description,
312
+ visibility: publishing.visibility,
313
+ username: publishing.username,
314
+ password: publishing.password,
315
+ },
316
+ visibilityOptions: ctx.client.events.visibilityOptions(),
317
+ errors: {
318
+ slug: "Oops",
319
+ },
320
+ eventErrors: null,
136
321
  _translations: [],
137
322
  },
138
323
  });
@@ -64,7 +64,7 @@ describe("Event revision unlock", () => {
64
64
  const revision = Factory.build("event_revision");
65
65
  const ctx = buildCtx(revision);
66
66
  const eventErrors = [
67
- { key: "generalError", message: "Failed to start revision" },
67
+ { key: "generalError", message: "Failed to unlock revision" },
68
68
  ];
69
69
 
70
70
  const mockUnlock = jest
@@ -76,7 +76,7 @@ describe("Event revision unlock", () => {
76
76
  }));
77
77
 
78
78
  await expect(UnlocksHandler.create(ctx)).rejects.toThrow(
79
- `Failed to start revision: ${JSON.stringify(eventErrors)}`
79
+ `Failed to unlock revision: ${JSON.stringify(eventErrors)}`
80
80
  );
81
81
 
82
82
  expect(mockUnlock).toHaveBeenCalledWith(revision.id, "en");