22 lines
1.2 KiB
TypeScript
22 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { createWorkScopeId, hasSelectedTimeslotScope } from '../../src/app/work-scope';
|
|
|
|
describe('Work timeslot scope', () => {
|
|
it('treats scanner-backed and GPO-only assessments as selected timeslots', () => {
|
|
expect(hasSelectedTimeslotScope(['scanner-run'], [])).toBe(true);
|
|
expect(hasSelectedTimeslotScope([], ['gpo-assessment'])).toBe(true);
|
|
expect(hasSelectedTimeslotScope(['scanner-run'], ['gpo-assessment'])).toBe(true);
|
|
expect(hasSelectedTimeslotScope([], [])).toBe(false);
|
|
expect(hasSelectedTimeslotScope()).toBe(false);
|
|
});
|
|
|
|
it('keeps the client aggregate and every timeslot workspace separate', () => {
|
|
expect(createWorkScopeId('client-a', [], ['gpo-slot'])).toBe('client-a::assessments::gpo-slot');
|
|
expect(createWorkScopeId('client-a', [], ['gpo-slot'])).not.toBe(createWorkScopeId('client-a'));
|
|
expect(createWorkScopeId('client-a')).toBe('client-a');
|
|
expect(createWorkScopeId('client-a', ['run-b', 'run-a'])).toBe('client-a::timeslot::run-a|run-b');
|
|
expect(createWorkScopeId('client-a', ['run-a', 'run-a'])).toBe('client-a::timeslot::run-a');
|
|
expect(createWorkScopeId('client-a', ['run-a'])).not.toBe(createWorkScopeId('client-a', ['run-b']));
|
|
});
|
|
});
|