Agrupar las tarjetas de CaMa y elegir el periodo en Trazabilidad
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import type { Measure } from 'fhir/r4';
|
||||
import { Fhir } from '../fhir';
|
||||
import { HISTORY } from './pages';
|
||||
import { TabTrazabilidad } from './tab-trazabilidad';
|
||||
|
||||
describe('Trazabilidad: periodo seleccionado', () => {
|
||||
for (const domain of ['cama', 'cacu']) {
|
||||
it(`applies a monthly and semester period to the ${domain} queries`, async () => {
|
||||
const requests: Record<string, string>[] = [];
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [TabTrazabilidad],
|
||||
providers: [
|
||||
{
|
||||
provide: Fhir,
|
||||
useValue: {
|
||||
all: async (_domain: string, _resource: string, params: Record<string, string>) => {
|
||||
requests.push(params);
|
||||
return [{ resourceType: 'Bundle', type: 'searchset', entry: [] }];
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}).compileComponents();
|
||||
const fixture = TestBed.createComponent(TabTrazabilidad);
|
||||
fixture.componentRef.setInput('domain', domain);
|
||||
fixture.componentRef.setInput('measures', [
|
||||
{ resourceType: 'Measure', id: 'test', name: HISTORY[domain].panels[0].measure },
|
||||
] as Measure[]);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
const component = fixture.componentInstance as any;
|
||||
component.chosen.set('2025-03');
|
||||
fixture.detectChanges();
|
||||
(fixture.nativeElement.querySelector('button[mat-flat-button]') as HTMLButtonElement).click();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
expect(requests.at(-1)?.['reporting-period'].split(',').at(-1)).toBe('2025-03');
|
||||
expect(requests.at(-1)?.['as-of']).toBeUndefined();
|
||||
component.setType('semester');
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.chosen.set('2024-S1');
|
||||
fixture.detectChanges();
|
||||
(fixture.nativeElement.querySelector('button[mat-flat-button]') as HTMLButtonElement).click();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
expect(requests.at(-1)?.['reporting-period'].split(',').at(-1)).toBe('2024-S1');
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user