21 lines
789 B
TypeScript
21 lines
789 B
TypeScript
import { TestBed } from '@angular/core/testing';
|
|
import { vi } from 'vitest';
|
|
import { PrivateAreaEditor } from './private-area-editor';
|
|
|
|
describe('PrivateAreaEditor', () => {
|
|
it('adds a stable private area and derives the main-room count from its family', () => {
|
|
const fixture = TestBed.createComponent(PrivateAreaEditor);
|
|
fixture.componentRef.setInput('areas', []);
|
|
const changed = vi.fn();
|
|
fixture.componentInstance.areasChanged.subscribe(changed);
|
|
|
|
fixture.componentInstance.addArea();
|
|
|
|
expect(changed).toHaveBeenCalledWith([
|
|
expect.objectContaining({ family: 'PIECE_PRINCIPALE', subtype: 'OTHER' }),
|
|
]);
|
|
fixture.componentRef.setInput('areas', changed.mock.calls[0][0]);
|
|
expect(fixture.componentInstance.mainRoomCount()).toBe(1);
|
|
});
|
|
});
|