feat(setup): prompt operator pack output routing
This commit is contained in:
@@ -43,6 +43,8 @@ describe('setupAutomation', () => {
|
||||
false, // configure google services
|
||||
],
|
||||
asks: [
|
||||
'telegram', // output channel
|
||||
'987654321', // output peer
|
||||
'0 3 * * *', // backup schedule
|
||||
'0 7 * * 1-5', // daily briefing schedule
|
||||
],
|
||||
@@ -61,11 +63,47 @@ describe('setupAutomation', () => {
|
||||
expect(backup.schedule).toBe('0 3 * * *');
|
||||
expect(heartbeat.enabled).toBe(true);
|
||||
expect(heartbeat.notify_cooldown).toBe('30m');
|
||||
expect((heartbeat.notify as Record<string, unknown>).channel).toBe('telegram');
|
||||
expect((heartbeat.notify as Record<string, unknown>).peer).toBe('987654321');
|
||||
expect(briefing.enabled).toBe(true);
|
||||
expect(briefing.schedule).toBe('0 7 * * 1-5');
|
||||
expect(minioSync.enabled).toBe(true);
|
||||
});
|
||||
|
||||
it('allows overriding operator pack output routing', async () => {
|
||||
const builder = new ConfigBuilder();
|
||||
|
||||
const p = makePrompter({
|
||||
confirms: [
|
||||
true, // enable operator pack
|
||||
false, // include minio sync
|
||||
false, // enable cron scheduler
|
||||
false, // enable webhook receiver
|
||||
false, // configure google services
|
||||
],
|
||||
asks: [
|
||||
'discord', // output channel
|
||||
'ops-room', // output peer
|
||||
'0 4 * * *', // backup schedule
|
||||
'0 9 * * *', // daily briefing schedule
|
||||
],
|
||||
});
|
||||
|
||||
await setupAutomation(p, builder);
|
||||
|
||||
const config = builder.build() as Record<string, unknown>;
|
||||
const backup = config.backup as Record<string, unknown>;
|
||||
const automation = config.automation as Record<string, unknown>;
|
||||
const heartbeat = automation.heartbeat as Record<string, unknown>;
|
||||
const briefing = automation.daily_briefing as Record<string, unknown>;
|
||||
|
||||
expect((backup.notify as Record<string, unknown>).channel).toBe('discord');
|
||||
expect((backup.notify as Record<string, unknown>).peer).toBe('ops-room');
|
||||
expect((heartbeat.notify as Record<string, unknown>).channel).toBe('discord');
|
||||
expect((briefing.output as Record<string, unknown>).peer).toBe('ops-room');
|
||||
expect(automation.minio_sync).toBeUndefined();
|
||||
});
|
||||
|
||||
it('leaves operator pack disabled when not selected', async () => {
|
||||
const builder = new ConfigBuilder();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user