Fix player cached images and blank time dates
This commit is contained in:
@@ -31,6 +31,25 @@ async function createTestService(options) {
|
||||
return { app, server, service, temporaryDirectory };
|
||||
}
|
||||
|
||||
test('local control leaves cached player media available to the static media route', async () => {
|
||||
const { app, server, temporaryDirectory } = await createTestService();
|
||||
const cachedImagePath = path.join(temporaryDirectory, 'player-cache', 'remote-images', 'cached-image.png');
|
||||
await fs.promises.mkdir(path.dirname(cachedImagePath), { recursive: true });
|
||||
await fs.promises.writeFile(cachedImagePath, 'cached-image');
|
||||
app.use('/media', express.static(temporaryDirectory));
|
||||
const listener = app.listen(0);
|
||||
try {
|
||||
const address = listener.address();
|
||||
const response = await fetch(`http://127.0.0.1:${address.port}/media/player-cache/remote-images/cached-image.png`);
|
||||
assert.equal(response.status, 200);
|
||||
assert.equal(await response.text(), 'cached-image');
|
||||
} finally {
|
||||
await new Promise((resolve) => listener.close(resolve));
|
||||
server.close();
|
||||
await fs.promises.rm(temporaryDirectory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test('local control authenticates only cached eligible users and scopes commands to local runtime', async () => {
|
||||
const { app, service, temporaryDirectory } = await createTestService();
|
||||
const password = hashPassword('CorrectHorseBatteryStaple!');
|
||||
|
||||
@@ -62,4 +62,23 @@ test('time/date region renders placeholder tokens on the player side', () => {
|
||||
);
|
||||
|
||||
assert.match(markup, /<p>\d{2}:\d{2}<\/p>/);
|
||||
});
|
||||
|
||||
test('time/date region stays blank when its format is blank', () => {
|
||||
const module = loadTimeDateModule();
|
||||
const markup = module.renderRegion(
|
||||
{
|
||||
pixelWidth: 320,
|
||||
pixelHeight: 180,
|
||||
canvasScale: 1,
|
||||
baseStyle: 'position:absolute;'
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
timezone: 'UTC'
|
||||
}
|
||||
);
|
||||
|
||||
assert.match(markup, /data-time-date-format=""/);
|
||||
assert.doesNotMatch(markup, /<p>\d{2}:\d{2}<\/p>/);
|
||||
});
|
||||
Reference in New Issue
Block a user