Release v2.15.2
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 4m34s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 57s

This commit is contained in:
lzstealth committed 2026-10-15 01:50:39 +01:00
1 parent ddcc665f81
commit 7295f83f04
43 files changed
+2526 -104

No files matched your search

+60 -5
View File
@@ -28,7 +28,8 @@ function createResponse() {
this.statusCode = code;
return this;
},
send() {
send(body) {
this.body = body;
return this;
}
};
@@ -36,12 +37,13 @@ function createResponse() {
test('playlist create and update redirect to the canonical edit path', async () => {
const calls = [];
let groupInsertParams = null;
const connection = {
async beginTransaction() {},
async commit() {},
async rollback() {},
release() {},
async query(sql) {
async query(sql, params) {
if (sql.startsWith('INSERT INTO c_playlists')) {
return [{ insertId: 4 }];
}
@@ -53,6 +55,14 @@ test('playlist create and update redirect to the canonical edit path', async ()
calls.push('delete-slides');
return [{ affectedRows: 1 }];
}
if (sql.startsWith('SELECT sl.id, st.canvas_size_id')) {
return [[{ id: 11, canvas_size_id: 7 }]];
}
if (sql.startsWith('INSERT INTO c_playlist_slides')) {
groupInsertParams = params;
calls.push('insert-slide');
return [{ insertId: 101 }];
}
return [[]];
}
};
@@ -73,7 +83,14 @@ test('playlist create and update redirect to the canonical edit path', async ()
fetchOrderedPlaylistSlides: async () => [],
fetchScreensByPlaylistId: async () => [],
fetchPlaylistCanvasId: async () => null,
readArrayField: () => [],
readArrayField(body, keys) {
for (const key of keys) {
if (Object.prototype.hasOwnProperty.call(body, key)) {
return Array.isArray(body[key]) ? body[key] : [body[key]];
}
}
return [];
},
getAuditUserId: () => 12,
redirectAfterSave(req, res, url) {
calls.push({ kind: 'redirectAfterSave', url, path: req.path });
@@ -110,17 +127,55 @@ test('playlist create and update redirect to the canonical edit path', async ()
params: { id: '4' },
body: {
name: 'Lunch Loop',
slide_id: []
slide_id: ['11'],
row_key: ['row-11'],
duration_seconds: ['10'],
use_video_duration: ['0'],
disable_audio: ['1'],
group_key: ['news'],
group_name: ['News'],
group_pick_count: ['1'],
group_shuffle: ['1'],
group_mode: ['repeat'],
group_repeat_count: ['2'],
group_schedule_rules_json: [JSON.stringify([{ start_time: '08:00', end_time: '17:00', days: [1, 2, 3] }])]
}
}, updateRes, () => {});
assert.equal(createRes.redirectedTo, '/playlists/4/edit');
assert.equal(updateRes.redirectedTo, '/playlists/4/edit');
assert.equal(updateRes.redirectedTo, '/playlists/4/edit', updateRes.statusCode + ': ' + String(updateRes.body || ''));
assert.deepEqual(groupInsertParams.slice(6, 10), [
'news',
'News',
1,
JSON.stringify([{ start_time: '08:00', end_time: '17:00', days: [1, 2, 3] }])
]);
assert.equal(groupInsertParams[10], 1);
assert.equal(groupInsertParams[11], 'repeat');
assert.equal(groupInsertParams[12], 2);
assert.deepEqual(calls, [
'delete-slides',
{ kind: 'redirectAfterSave', url: '/playlists/4/edit', path: '/playlists' },
'update-playlist',
'delete-slides',
'insert-slide',
{ kind: 'redirectAfterSave', url: '/playlists/4/edit', path: '/playlists/4' }
]);
for (const pickCount of ['0', '2']) {
const invalidRes = createResponse();
await updateHandlers[1]({
path: '/playlists/4',
params: { id: '4' },
body: { name: 'Lunch Loop', slide_id: ['11'], group_key: ['news'], group_name: ['News'], group_pick_count: [pickCount] }
}, invalidRes, () => {});
assert.equal(invalidRes.statusCode, 400);
}
for (const settings of [{ group_mode: ['unknown'] }, { group_repeat_count: ['0'] }, { group_repeat_count: ['101'] }, { group_repeat_count: ['1.5'] }]) {
const invalidRes = createResponse();
await updateHandlers[1]({
path: '/playlists/4', params: { id: '4' },
body: Object.assign({ name: 'Lunch Loop', slide_id: ['11'], group_key: ['news'], group_name: ['News'], group_pick_count: ['1'] }, settings)
}, invalidRes, () => {});
assert.equal(invalidRes.statusCode, 400);
}
});