This commit is contained in:
Andras Schmelczer 2026-09-11 16:58:56 +01:00
commit 9689bfcc18
23 changed files with 1815 additions and 955 deletions

View file

@ -62,7 +62,7 @@ const skirt: SkirtingPlan = {
};
describe('cut list CSV', () => {
it('exports measured cuts, shape coordinates, mitres, allocations and purchase counts', () => {
it('exports measured cuts, shape coordinates, mitres, board references and purchase counts', () => {
const csv = cutListCsv(defaultProject(), floor, skirt);
expect(csv.startsWith('\uFEFF"Material"')).toBe(true);
expect(csv).toContain('"Flooring","Living room","F1","B1","450","190"');
@ -70,11 +70,9 @@ describe('cut list CSV', () => {
expect(csv).toContain('0.0:0.0 | 450.0:0.0 | 450.0:190.0 | 0.0:100.0');
expect(csv).toContain('"Skirting","Living room","A1","S1","1518","18","0","45"');
expect(csv).toContain('Back length 1500.0 mm; left square; right external');
expect(csv).toContain('Remaining length 747.0 mm');
expect(csv).toContain('Waste including kerf 879.0 mm');
expect(csv).toContain('Boards to buy; 1 installed pieces; 2 saw cuts');
expect(csv).not.toContain('Check the shaped edge.');
expect(csv.split('\r\n')).toHaveLength(8);
expect(csv.split('\r\n')).toHaveLength(6);
});
it('counts uncut full boards and lengths without exporting their codes or source allocations', () => {
@ -134,12 +132,12 @@ describe('cut list CSV', () => {
expect(csv).toContain('"Skirting total","","","","","18","","","2"');
expect(csv.split('\r\n').filter((row) => row.startsWith('"Flooring",'))).toHaveLength(2);
expect(csv.split('\r\n').filter((row) => row.startsWith('"Skirting",'))).toHaveLength(1);
expect(csv.split('\r\n').filter((row) => row.startsWith('"Flooring stock",'))).toHaveLength(1);
expect(csv.split('\r\n').filter((row) => row.startsWith('"Skirting stock",'))).toHaveLength(1);
expect(csv.split('\r\n').filter((row) => row.startsWith('"Flooring stock",'))).toHaveLength(0);
expect(csv.split('\r\n').filter((row) => row.startsWith('"Skirting stock",'))).toHaveLength(0);
expect(flooringCuts(floorPlan)).toEqual([...floor.pieces, readyOffcut]);
expect(csv).toContain('"Flooring","Living room","READY-F","B1","747","190"');
expect(csv).toContain('Reused offcut; Use offcut; no new cut');
expect(csv).toContain('"Flooring stock","","F1 / READY-F","B1"');
expect(csv).not.toContain('"Flooring stock"');
expect(uncutFlooring(floorPlan, project.flooring)).toEqual({ wholeBoards: 1, readyOffcuts: 1 });
expect(uncutSkirting(skirtPlan)).toEqual([{ length: 2400, count: 1 }]);
});