This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { resolveDashboardScope } from '../../src/dashboardScope';
|
||||
|
||||
describe('resolveDashboardScope', () => {
|
||||
it('resolves exact declared defaults and drops non-string scope data', () => {
|
||||
expect(resolveDashboardScope(
|
||||
{ serverId: '$server', literal: 'disk-1', unsafe: 42 },
|
||||
[{ name: 'server', default: 'primary' }],
|
||||
)).toEqual({ serverId: 'primary', literal: 'disk-1' });
|
||||
});
|
||||
|
||||
it('preserves unresolved and partial references for fail-closed API validation', () => {
|
||||
expect(resolveDashboardScope(
|
||||
{ serverId: '$missing', containerId: 'prefix-$server' },
|
||||
[{ name: 'server', default: 'primary' }],
|
||||
)).toEqual({ serverId: '$missing', containerId: 'prefix-$server' });
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user