Closed
Description
🐞 Bug report
Command (mark with an x
)
- schematics
Is this a regression?
No
Description
From #20190.
UpdateRecorder
doesn't support multiple adjacent inserts.
🔬 Minimal Reproduction
it('works with multiple adjacent inserts', () => {
const buffer = Buffer.from('Hello beautiful World');
const entry = new SimpleFileEntry(normalize('/some/path'), buffer);
const recorder = new UpdateRecorderBase(entry);
recorder.remove(6, 9);
recorder.insertRight(6, 'amazing');
recorder.insertRight(15, ' and fantastic');
const result = recorder.apply(buffer);
expect(result.toString()).toBe('Hello amazing and fantastic World');
});
Anything else relevant?
Best workaround is probably to use something more comprehensive like magic-string
, but that probably shouldn't be required for something this simple.