Update more DecorationService tests to use existing bufferService.

This commit is contained in:
Per Bothner
2026-05-31 09:48:19 -07:00
parent f76c7aa8ea
commit 7c82c1a815
+3 -11
View File
@@ -94,18 +94,16 @@ describe('DecorationService', () => {
});
it('should find multi-line decoration when single-line decorations exist on other lines', () => {
const bufferService = new MockBufferService(80, 24, new MockOptionsService());
const serviceWithBuffer = new DecorationService(new MockLogService(), bufferService);
const buffer = bufferService.buffer;
(buffer as Buffer).fillViewportRows();
for (let i = 0; i < buffer.lines.length; i++) {
serviceWithBuffer.registerDecoration({
service.registerDecoration({
marker: buffer.addMarker(i),
width: 5
});
}
const multiLine = serviceWithBuffer.registerDecoration({
const multiLine = service.registerDecoration({
marker: buffer.addMarker(10),
width: 10,
height: 3
@@ -113,7 +111,7 @@ describe('DecorationService', () => {
assert.ok(multiLine);
const found: typeof multiLine[] = [];
serviceWithBuffer.forEachDecorationAtCell(0, 11, undefined, d => found.push(d));
service.forEachDecorationAtCell(0, 11, undefined, d => found.push(d));
assert.include(found, multiLine);
});
});
@@ -143,8 +141,6 @@ describe('DecorationService', () => {
describe('line index maintenance', () => {
it('should keep lookups correct after buffer trim', () => {
const bufferService = new MockBufferService(80, 5, new MockOptionsService({ scrollback: 0 }));
const service = new DecorationService(new MockLogService(), bufferService);
const buffer = bufferService.buffer;
(buffer as Buffer).fillViewportRows();
@@ -160,8 +156,6 @@ describe('DecorationService', () => {
});
it('should remove decoration from line index when marker is trimmed off buffer', () => {
const bufferService = new MockBufferService(80, 5, new MockOptionsService({ scrollback: 0 }));
const service = new DecorationService(new MockLogService(), bufferService);
const buffer = bufferService.buffer;
(buffer as Buffer).fillViewportRows();
@@ -179,8 +173,6 @@ describe('DecorationService', () => {
});
it('should keep multi-line decoration indexed after line insert', async () => {
const bufferService = new MockBufferService(80, 10, new MockOptionsService({ scrollback: 100 }));
const service = new DecorationService(new MockLogService(), bufferService);
const buffer = bufferService.buffer;
(buffer as Buffer).fillViewportRows();