mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-13 10:09:35 +00:00
0f27334f97
Use consistent lifecycle labels and output summaries in the automation and event editor views.
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import type { AutomationOutput } from 'ontime-types';
|
|
|
|
import { summariseOutputs } from '../automationOutputs';
|
|
|
|
describe('summariseOutputs', () => {
|
|
it('returns an empty list when there are no outputs', () => {
|
|
expect(summariseOutputs([])).toEqual([]);
|
|
});
|
|
|
|
it('counts repeated output kinds', () => {
|
|
const outputs: AutomationOutput[] = [
|
|
{ type: 'osc', targetIP: '127.0.0.1', targetPort: 8000, address: '/go', args: '' },
|
|
{ type: 'osc', targetIP: '127.0.0.1', targetPort: 8000, address: '/stop', args: '' },
|
|
{ type: 'http', url: 'http://127.0.0.1/start' },
|
|
];
|
|
|
|
expect(summariseOutputs(outputs)).toEqual([
|
|
{ type: 'osc', label: 'OSC', count: 2 },
|
|
{ type: 'http', label: 'HTTP', count: 1 },
|
|
]);
|
|
});
|
|
|
|
it('presents kinds in a stable order regardless of insertion order', () => {
|
|
const outputs: AutomationOutput[] = [
|
|
{ type: 'ontime', action: 'aux1-start' },
|
|
{ type: 'http', url: 'http://127.0.0.1/start' },
|
|
{ type: 'osc', targetIP: '127.0.0.1', targetPort: 8000, address: '/go', args: '' },
|
|
];
|
|
|
|
expect(summariseOutputs(outputs).map(({ type }) => type)).toEqual(['osc', 'http', 'ontime']);
|
|
});
|
|
});
|