@saltcorn/server 1.0.0-beta.9 → 1.0.0-rc.10
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.
- package/app.js +4 -7
- package/auth/admin.js +1 -0
- package/auth/routes.js +4 -1
- package/help/Aggregation where formula.tmd +11 -0
- package/help/Calculated fields.tmd +28 -0
- package/help/Date format.tmd +55 -0
- package/help/Protected fields.tmd +4 -0
- package/help/Snapshots.tmd +19 -0
- package/help/Table history.tmd +42 -0
- package/help/index.js +4 -1
- package/load_plugins.js +90 -8
- package/locales/en.json +14 -1
- package/locales/pl.json +407 -85
- package/package.json +11 -11
- package/public/gridedit.js +3 -1
- package/public/saltcorn-builder.css +0 -7
- package/public/saltcorn-common.js +196 -101
- package/public/saltcorn.css +17 -0
- package/public/saltcorn.js +91 -17
- package/routes/actions.js +19 -25
- package/routes/admin.js +256 -54
- package/routes/api.js +36 -1
- package/routes/delete.js +4 -1
- package/routes/eventlog.js +2 -1
- package/routes/fields.js +21 -5
- package/routes/files.js +9 -2
- package/routes/infoarch.js +40 -2
- package/routes/list.js +1 -1
- package/routes/menu.js +3 -0
- package/routes/pageedit.js +9 -2
- package/routes/plugins.js +124 -28
- package/routes/scapi.js +19 -0
- package/routes/search.js +6 -1
- package/routes/sync.js +3 -5
- package/routes/tables.js +14 -4
- package/routes/viewedit.js +7 -4
- package/serve.js +17 -3
- package/tests/api.test.js +29 -0
- package/tests/fields.test.js +32 -0
- package/tests/plugin_install.test.js +235 -0
- package/tests/plugins.test.js +140 -0
package/tests/fields.test.js
CHANGED
|
@@ -350,6 +350,38 @@ describe("Field Endpoints", () => {
|
|
|
350
350
|
.set("Cookie", loginCookie)
|
|
351
351
|
.expect(toInclude(" is: <pre>2</pre>"));
|
|
352
352
|
});
|
|
353
|
+
it("should show on stored expression with joinfield", async () => {
|
|
354
|
+
const loginCookie = await getAdminLoginCookie();
|
|
355
|
+
const table = Table.findOne({ name: "books" });
|
|
356
|
+
|
|
357
|
+
const ctx = encodeURIComponent(JSON.stringify({ table_id: table.id }));
|
|
358
|
+
const app = await getApp({ disableCsrf: true });
|
|
359
|
+
await request(app)
|
|
360
|
+
.post("/field/test-formula")
|
|
361
|
+
.send({
|
|
362
|
+
formula: "publisher.name",
|
|
363
|
+
tablename: "books",
|
|
364
|
+
stored: true,
|
|
365
|
+
})
|
|
366
|
+
.set("Cookie", loginCookie)
|
|
367
|
+
.expect(toInclude(" is: <pre>"));
|
|
368
|
+
});
|
|
369
|
+
it("should fail on non-stored expression with joinfield", async () => {
|
|
370
|
+
const loginCookie = await getAdminLoginCookie();
|
|
371
|
+
const table = Table.findOne({ name: "books" });
|
|
372
|
+
|
|
373
|
+
const ctx = encodeURIComponent(JSON.stringify({ table_id: table.id }));
|
|
374
|
+
const app = await getApp({ disableCsrf: true });
|
|
375
|
+
await request(app)
|
|
376
|
+
.post("/field/test-formula")
|
|
377
|
+
.send({
|
|
378
|
+
formula: "publisher.name",
|
|
379
|
+
tablename: "books",
|
|
380
|
+
stored: false,
|
|
381
|
+
})
|
|
382
|
+
.set("Cookie", loginCookie)
|
|
383
|
+
.expect(400);
|
|
384
|
+
});
|
|
353
385
|
it("should show calculated", async () => {
|
|
354
386
|
const loginCookie = await getAdminLoginCookie();
|
|
355
387
|
const table = Table.findOne({ name: "books" });
|
|
@@ -112,3 +112,238 @@ describe("Tenant cannot install unsafe plugins", () => {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
|
+
|
|
116
|
+
describe("Stable versioning install", () => {
|
|
117
|
+
/*
|
|
118
|
+
empty_sc_test_plugin:
|
|
119
|
+
- starts without engine property but from the second version on it has
|
|
120
|
+
empty_sc_test_plugin_two:
|
|
121
|
+
- has no engine property in any version
|
|
122
|
+
*/
|
|
123
|
+
beforeEach(async () => {
|
|
124
|
+
for (const plugin of [
|
|
125
|
+
"@christianhugoch/empty_sc_test_plugin",
|
|
126
|
+
"@christianhugoch/empty_sc_test_plugin_two",
|
|
127
|
+
]) {
|
|
128
|
+
const dbPlugin = await Plugin.findOne({ name: plugin });
|
|
129
|
+
if (dbPlugin) await dbPlugin.delete();
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
it("installs latest", async () => {
|
|
133
|
+
const loadAndSaveNewPlugin = load_plugins.loadAndSaveNewPlugin;
|
|
134
|
+
await loadAndSaveNewPlugin(
|
|
135
|
+
new Plugin({
|
|
136
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
137
|
+
location: "@christianhugoch/empty_sc_test_plugin_two",
|
|
138
|
+
source: "npm",
|
|
139
|
+
version: "latest",
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
const dbPlugin = await Plugin.findOne({
|
|
143
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
144
|
+
});
|
|
145
|
+
expect(dbPlugin).not.toBe(null);
|
|
146
|
+
expect(dbPlugin.version).toBe("0.0.3");
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it("installs and downgrades latest", async () => {
|
|
150
|
+
const loadAndSaveNewPlugin = load_plugins.loadAndSaveNewPlugin;
|
|
151
|
+
await loadAndSaveNewPlugin(
|
|
152
|
+
new Plugin({
|
|
153
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
154
|
+
location: "@christianhugoch/empty_sc_test_plugin",
|
|
155
|
+
source: "npm",
|
|
156
|
+
version: "latest",
|
|
157
|
+
}),
|
|
158
|
+
true
|
|
159
|
+
);
|
|
160
|
+
const dbPlugin = await Plugin.findOne({
|
|
161
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
162
|
+
});
|
|
163
|
+
expect(dbPlugin).not.toBe(null);
|
|
164
|
+
expect(dbPlugin.version).toBe("0.0.6");
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it("installs a fixed version", async () => {
|
|
168
|
+
const loadAndSaveNewPlugin = load_plugins.loadAndSaveNewPlugin;
|
|
169
|
+
await loadAndSaveNewPlugin(
|
|
170
|
+
new Plugin({
|
|
171
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
172
|
+
location: "@christianhugoch/empty_sc_test_plugin",
|
|
173
|
+
source: "npm",
|
|
174
|
+
version: "0.0.5",
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
const dbPlugin = await Plugin.findOne({
|
|
178
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
179
|
+
});
|
|
180
|
+
expect(dbPlugin).not.toBe(null);
|
|
181
|
+
expect(dbPlugin.version).toBe("0.0.6");
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it("installs and downgrades a fixed version", async () => {
|
|
185
|
+
const loadAndSaveNewPlugin = load_plugins.loadAndSaveNewPlugin;
|
|
186
|
+
await loadAndSaveNewPlugin(
|
|
187
|
+
new Plugin({
|
|
188
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
189
|
+
location: "@christianhugoch/empty_sc_test_plugin",
|
|
190
|
+
source: "npm",
|
|
191
|
+
version: "0.0.6",
|
|
192
|
+
}),
|
|
193
|
+
true
|
|
194
|
+
);
|
|
195
|
+
const dbPlugin = await Plugin.findOne({
|
|
196
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
197
|
+
});
|
|
198
|
+
expect(dbPlugin).not.toBe(null);
|
|
199
|
+
expect(dbPlugin.version).toBe("0.0.6");
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
describe("Stable versioning upgrade", () => {
|
|
204
|
+
beforeEach(async () => {
|
|
205
|
+
for (const plugin of [
|
|
206
|
+
"@christianhugoch/empty_sc_test_plugin",
|
|
207
|
+
"@christianhugoch/empty_sc_test_plugin_two",
|
|
208
|
+
]) {
|
|
209
|
+
const dbPlugin = await Plugin.findOne({ name: plugin });
|
|
210
|
+
if (dbPlugin) await dbPlugin.delete();
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it("upgrades to latest", async () => {
|
|
215
|
+
const loadAndSaveNewPlugin = load_plugins.loadAndSaveNewPlugin;
|
|
216
|
+
await loadAndSaveNewPlugin(
|
|
217
|
+
new Plugin({
|
|
218
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
219
|
+
location: "@christianhugoch/empty_sc_test_plugin_two",
|
|
220
|
+
source: "npm",
|
|
221
|
+
version: "0.0.1",
|
|
222
|
+
}),
|
|
223
|
+
true
|
|
224
|
+
);
|
|
225
|
+
const oldPlugin = await Plugin.findOne({
|
|
226
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
227
|
+
});
|
|
228
|
+
expect(oldPlugin).not.toBe(null);
|
|
229
|
+
expect(oldPlugin.version).toBe("0.0.1");
|
|
230
|
+
|
|
231
|
+
await loadAndSaveNewPlugin(
|
|
232
|
+
new Plugin({
|
|
233
|
+
id: oldPlugin.id,
|
|
234
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
235
|
+
location: "@christianhugoch/empty_sc_test_plugin_two",
|
|
236
|
+
source: "npm",
|
|
237
|
+
version: "latest",
|
|
238
|
+
}),
|
|
239
|
+
true
|
|
240
|
+
);
|
|
241
|
+
const newPlugin = await Plugin.findOne({
|
|
242
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
243
|
+
});
|
|
244
|
+
expect(newPlugin).not.toBe(null);
|
|
245
|
+
expect(newPlugin.version).toBe("0.0.3");
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it("upgrades to latest with downgrade", async () => {
|
|
249
|
+
const loadAndSaveNewPlugin = load_plugins.loadAndSaveNewPlugin;
|
|
250
|
+
await loadAndSaveNewPlugin(
|
|
251
|
+
new Plugin({
|
|
252
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
253
|
+
location: "@christianhugoch/empty_sc_test_plugin",
|
|
254
|
+
source: "npm",
|
|
255
|
+
version: "0.0.1",
|
|
256
|
+
}),
|
|
257
|
+
true
|
|
258
|
+
);
|
|
259
|
+
const oldPlugin = await Plugin.findOne({
|
|
260
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
261
|
+
});
|
|
262
|
+
expect(oldPlugin).not.toBe(null);
|
|
263
|
+
expect(oldPlugin.version).toBe("0.0.1");
|
|
264
|
+
|
|
265
|
+
await loadAndSaveNewPlugin(
|
|
266
|
+
new Plugin({
|
|
267
|
+
id: oldPlugin.id,
|
|
268
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
269
|
+
location: "@christianhugoch/empty_sc_test_plugin",
|
|
270
|
+
source: "npm",
|
|
271
|
+
version: "latest",
|
|
272
|
+
}),
|
|
273
|
+
true
|
|
274
|
+
);
|
|
275
|
+
const newPlugin = await Plugin.findOne({
|
|
276
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
277
|
+
});
|
|
278
|
+
expect(newPlugin).not.toBe(null);
|
|
279
|
+
expect(newPlugin.version).toBe("0.0.6");
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it("upgrades to fixed version", async () => {
|
|
283
|
+
const loadAndSaveNewPlugin = load_plugins.loadAndSaveNewPlugin;
|
|
284
|
+
await loadAndSaveNewPlugin(
|
|
285
|
+
new Plugin({
|
|
286
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
287
|
+
location: "@christianhugoch/empty_sc_test_plugin_two",
|
|
288
|
+
source: "npm",
|
|
289
|
+
version: "0.0.1",
|
|
290
|
+
}),
|
|
291
|
+
true
|
|
292
|
+
);
|
|
293
|
+
const oldPlugin = await Plugin.findOne({
|
|
294
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
295
|
+
});
|
|
296
|
+
expect(oldPlugin).not.toBe(null);
|
|
297
|
+
expect(oldPlugin.version).toBe("0.0.1");
|
|
298
|
+
|
|
299
|
+
await loadAndSaveNewPlugin(
|
|
300
|
+
new Plugin({
|
|
301
|
+
id: oldPlugin.id,
|
|
302
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
303
|
+
location: "@christianhugoch/empty_sc_test_plugin_two",
|
|
304
|
+
source: "npm",
|
|
305
|
+
version: "0.0.3",
|
|
306
|
+
}),
|
|
307
|
+
true
|
|
308
|
+
);
|
|
309
|
+
const newPlugin = await Plugin.findOne({
|
|
310
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
311
|
+
});
|
|
312
|
+
expect(newPlugin).not.toBe(null);
|
|
313
|
+
expect(newPlugin.version).toBe("0.0.3");
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
it("upgrades to fixed version with downgrade", async () => {
|
|
317
|
+
const loadAndSaveNewPlugin = load_plugins.loadAndSaveNewPlugin;
|
|
318
|
+
await loadAndSaveNewPlugin(
|
|
319
|
+
new Plugin({
|
|
320
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
321
|
+
location: "@christianhugoch/empty_sc_test_plugin",
|
|
322
|
+
source: "npm",
|
|
323
|
+
version: "0.0.1",
|
|
324
|
+
}),
|
|
325
|
+
true
|
|
326
|
+
);
|
|
327
|
+
const oldPlugin = await Plugin.findOne({
|
|
328
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
329
|
+
});
|
|
330
|
+
expect(oldPlugin).not.toBe(null);
|
|
331
|
+
expect(oldPlugin.version).toBe("0.0.1");
|
|
332
|
+
|
|
333
|
+
await loadAndSaveNewPlugin(
|
|
334
|
+
new Plugin({
|
|
335
|
+
id: oldPlugin.id,
|
|
336
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
337
|
+
location: "@christianhugoch/empty_sc_test_plugin",
|
|
338
|
+
source: "npm",
|
|
339
|
+
version: "0.0.6",
|
|
340
|
+
}),
|
|
341
|
+
true
|
|
342
|
+
);
|
|
343
|
+
const newPlugin = await Plugin.findOne({
|
|
344
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
345
|
+
});
|
|
346
|
+
expect(newPlugin).not.toBe(null);
|
|
347
|
+
expect(newPlugin.version).toBe("0.0.6");
|
|
348
|
+
});
|
|
349
|
+
});
|
package/tests/plugins.test.js
CHANGED
|
@@ -10,6 +10,7 @@ const {
|
|
|
10
10
|
toInclude,
|
|
11
11
|
toNotInclude,
|
|
12
12
|
toRedirect,
|
|
13
|
+
toSucceed,
|
|
13
14
|
resetToFixtures,
|
|
14
15
|
} = require("../auth/testhelp");
|
|
15
16
|
const db = require("@saltcorn/data/db");
|
|
@@ -308,6 +309,7 @@ describe("config endpoints", () => {
|
|
|
308
309
|
.post("/admin")
|
|
309
310
|
.send("site_name=FooSiteName")
|
|
310
311
|
.send("multitenancy_enabled=on")
|
|
312
|
+
.send("plugins_store_endpoint=https://store.saltcorn.com/api/extensions")
|
|
311
313
|
.set("Cookie", loginCookie)
|
|
312
314
|
.expect(toRedirect("/admin/"));
|
|
313
315
|
await request(app)
|
|
@@ -316,3 +318,141 @@ describe("config endpoints", () => {
|
|
|
316
318
|
.expect(toInclude(">FooSiteName<"));
|
|
317
319
|
});
|
|
318
320
|
});
|
|
321
|
+
|
|
322
|
+
const installPlugin = async (name, version) => {
|
|
323
|
+
const loginCookie = await getAdminLoginCookie();
|
|
324
|
+
const app = await getApp({ disableCsrf: true });
|
|
325
|
+
await request(app)
|
|
326
|
+
.post("/plugins")
|
|
327
|
+
.send(
|
|
328
|
+
`name=${encodeURIComponent(name)}&location=${encodeURIComponent(
|
|
329
|
+
name
|
|
330
|
+
)}&source=npm&version=${version}`
|
|
331
|
+
)
|
|
332
|
+
.set("Cookie", loginCookie)
|
|
333
|
+
.expect(toRedirect("/plugins"));
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const setupPluginVersion = async (name, version) => {
|
|
337
|
+
let oldPlugin = await Plugin.findOne({
|
|
338
|
+
name: name,
|
|
339
|
+
});
|
|
340
|
+
if (!oldPlugin) await installPlugin(name, version);
|
|
341
|
+
else {
|
|
342
|
+
oldPlugin.version = version;
|
|
343
|
+
await oldPlugin.upsert();
|
|
344
|
+
}
|
|
345
|
+
return await Plugin.findOne({
|
|
346
|
+
name: name,
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
describe("Upgrade plugin to supported version", () => {
|
|
350
|
+
it("upgrades to latest", async () => {
|
|
351
|
+
const oldPlugin = await setupPluginVersion(
|
|
352
|
+
"@christianhugoch/empty_sc_test_plugin_two",
|
|
353
|
+
"0.0.1"
|
|
354
|
+
);
|
|
355
|
+
expect(oldPlugin.version).toBe("0.0.1");
|
|
356
|
+
const loginCookie = await getAdminLoginCookie();
|
|
357
|
+
const app = await getApp({ disableCsrf: true });
|
|
358
|
+
await request(app)
|
|
359
|
+
.get("/plugins/upgrade")
|
|
360
|
+
.set("Cookie", loginCookie)
|
|
361
|
+
.expect(toRedirect("/plugins"));
|
|
362
|
+
const upgradedPlugin = await Plugin.findOne({
|
|
363
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
364
|
+
});
|
|
365
|
+
expect(upgradedPlugin.version).toBe("0.0.3");
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
it("upgrades to the most current fixed version", async () => {
|
|
369
|
+
const oldPlugin = await setupPluginVersion(
|
|
370
|
+
"@christianhugoch/empty_sc_test_plugin_two",
|
|
371
|
+
"0.0.1"
|
|
372
|
+
);
|
|
373
|
+
await oldPlugin.upsert();
|
|
374
|
+
expect(oldPlugin.version).toBe("0.0.1");
|
|
375
|
+
const loginCookie = await getAdminLoginCookie();
|
|
376
|
+
const app = await getApp({ disableCsrf: true });
|
|
377
|
+
await request(app)
|
|
378
|
+
.post(
|
|
379
|
+
`/plugins/install/${encodeURIComponent(
|
|
380
|
+
"@christianhugoch/empty_sc_test_plugin_two"
|
|
381
|
+
)}`
|
|
382
|
+
)
|
|
383
|
+
.send("version=0.0.3")
|
|
384
|
+
.set("Cookie", loginCookie)
|
|
385
|
+
.expect(toRedirect("/plugins"));
|
|
386
|
+
const upgradedPlugin = await Plugin.findOne({
|
|
387
|
+
name: "@christianhugoch/empty_sc_test_plugin_two",
|
|
388
|
+
});
|
|
389
|
+
expect(upgradedPlugin.version).toBe("0.0.3");
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it("upgrades with a downgrade of the latest version", async () => {
|
|
393
|
+
const oldPlugin = await setupPluginVersion(
|
|
394
|
+
"@christianhugoch/empty_sc_test_plugin",
|
|
395
|
+
"0.0.1"
|
|
396
|
+
);
|
|
397
|
+
expect(oldPlugin.version).toBe("0.0.1");
|
|
398
|
+
const loginCookie = await getAdminLoginCookie();
|
|
399
|
+
const app = await getApp({ disableCsrf: true });
|
|
400
|
+
await request(app)
|
|
401
|
+
.get("/plugins/upgrade")
|
|
402
|
+
.set("Cookie", loginCookie)
|
|
403
|
+
.expect(toRedirect("/plugins"));
|
|
404
|
+
const upgradedPlugin = await Plugin.findOne({
|
|
405
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
406
|
+
});
|
|
407
|
+
expect(upgradedPlugin.version).toBe("0.0.6");
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
it("upgrades with a downgrade of the most current fixed version", async () => {
|
|
411
|
+
const oldPlugin = await setupPluginVersion(
|
|
412
|
+
"@christianhugoch/empty_sc_test_plugin",
|
|
413
|
+
"0.0.1"
|
|
414
|
+
);
|
|
415
|
+
expect(oldPlugin.version).toBe("0.0.1");
|
|
416
|
+
const loginCookie = await getAdminLoginCookie();
|
|
417
|
+
const app = await getApp({ disableCsrf: true });
|
|
418
|
+
await request(app)
|
|
419
|
+
.post(
|
|
420
|
+
`/plugins/install/${encodeURIComponent(
|
|
421
|
+
"@christianhugoch/empty_sc_test_plugin"
|
|
422
|
+
)}`
|
|
423
|
+
)
|
|
424
|
+
.send("version=0.1.0")
|
|
425
|
+
.set("Cookie", loginCookie)
|
|
426
|
+
.expect(toRedirect("/plugins"));
|
|
427
|
+
const upgradedPlugin = await Plugin.findOne({
|
|
428
|
+
name: "@christianhugoch/empty_sc_test_plugin",
|
|
429
|
+
});
|
|
430
|
+
expect(upgradedPlugin.version).toBe("0.0.6");
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
describe("install a different version dialog", () => {
|
|
435
|
+
it("sends the dialog", async () => {
|
|
436
|
+
const loginCookie = await getAdminLoginCookie();
|
|
437
|
+
const app = await getApp({ disableCsrf: true });
|
|
438
|
+
await request(app)
|
|
439
|
+
.get("/plugins/versions_dialog/any-bootstrap-theme")
|
|
440
|
+
.set("Cookie", loginCookie)
|
|
441
|
+
.expect(toInclude(["0.5.14", "0.5.14", "0.5.13", "0.5.12", "0.1.0"]));
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
it("filters not supported versions", async () => {
|
|
445
|
+
await installPlugin("@christianhugoch/empty_sc_test_plugin", "latest");
|
|
446
|
+
const loginCookie = await getAdminLoginCookie();
|
|
447
|
+
const app = await getApp({ disableCsrf: true });
|
|
448
|
+
await request(app)
|
|
449
|
+
.get(
|
|
450
|
+
`/plugins/versions_dialog/${encodeURIComponent(
|
|
451
|
+
"@christianhugoch/empty_sc_test_plugin"
|
|
452
|
+
)}`
|
|
453
|
+
)
|
|
454
|
+
.set("Cookie", loginCookie)
|
|
455
|
+
.expect(toInclude(["0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6"]))
|
|
456
|
+
.expect(toNotInclude("0.1.0"));
|
|
457
|
+
});
|
|
458
|
+
});
|