Banners reach a site the Hub installed
Found in the VM test: a Hub-installed site registers with its licence key, but its deployment was never linked to that registration, so update and closing banners were silently skipped. Registration now makes the link, and a notice makes it for sites that registered before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ls1vMdni7EfytGYqQTprME
This commit is contained in:
@@ -294,3 +294,21 @@ describe('settings for servers (found in the VM test)', () => {
|
||||
expect(await servers.portRange()).toEqual({ from: 21000, to: 21100 });
|
||||
});
|
||||
});
|
||||
|
||||
describe('banners reach a site the Hub installed (found in the VM test)', () => {
|
||||
test('an update to a deployment registered through its licence gets a banner', async () => {
|
||||
const { server } = await joinServer();
|
||||
await servers.setServerConfig(server.id, { TRUST_PROXY: 'loopback' });
|
||||
await db.release.create({ data: { product: 'events', version: '2.4.0', notes: 'New', releasedAt: NOW } });
|
||||
// A Hub install: the deployment knows its licence, not yet its install.
|
||||
await db.licence.create({ data: { id: 'lic-9', customerId: 'cust-1', product: 'events', key: 'CEH-TEST' } });
|
||||
await db.install.create({ data: { id: 'inst-9', customerId: 'cust-1', licenceId: 'lic-9', product: 'events', name: 'Hope', url: 'https://events.hope.test', secret: 'x', version: '2.3.0' } });
|
||||
const d = await db.deployment.create({ data: { id: 'dep-9', serverId: server.id, customerId: 'cust-1', licenceId: 'lic-9', product: 'events', shortName: 'hope', domain: 'events.hope.test', webPort: 20000, apiPort: 20001, status: 'live', version: '2.3.0' } });
|
||||
const r = await jobs.scheduleUpdate({ deploymentIds: [d.id], version: '2.4.0', at: new Date(NOW.getTime() + 5 * H) }, admin, NOW);
|
||||
const job = await db.job.findUnique({ where: { id: r.jobs[0].id } });
|
||||
expect(job.noticeId).toBeTruthy();
|
||||
const notice = await db.notice.findUnique({ where: { id: job.noticeId } });
|
||||
expect(notice).toMatchObject({ showBanner: true, installIds: ['inst-9'] });
|
||||
expect((await db.deployment.findUnique({ where: { id: d.id } })).installId).toBe('inst-9');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user