Skip to content

Commit 7bafb7f

Browse files
authored
fix(test): stabilize flaky cleanUpParagraphWithAnnotations tests (#2262)
1 parent bd0b49e commit 7bafb7f

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

packages/super-editor/src/extensions/field-annotation/cleanup-commands/cleanUpParagraphWithAnnotation.test.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ const textContent = (docNode) => docNode.textContent;
2727
const mockHelperPath = '../fieldAnnotationHelpers/index.js';
2828

2929
describe('cleanUpParagraphWithAnnotations - test range error crash', () => {
30+
beforeEach(() => {
31+
vi.resetModules();
32+
});
33+
3034
/** Test to fix error in position out of range in original */
3135
it('throws RangeError "Position … out of range" on single-paragraph doc', async () => {
3236
const doc = schema.node('doc', null, [p.createAndFill(null, [text('A')])]);
@@ -49,15 +53,6 @@ describe('cleanUpParagraphWithAnnotations - test range error crash', () => {
4953
});
5054
});
5155

52-
if (!Object.getOwnPropertyDescriptor(PMNode.prototype, 'children')) {
53-
Object.defineProperty(PMNode.prototype, 'children', {
54-
get() {
55-
return { length: this.childCount };
56-
},
57-
configurable: true,
58-
});
59-
}
60-
6156
describe('cleanUpParagraphWithAnnotations – original behavior', () => {
6257
beforeEach(() => {
6358
vi.resetModules();

0 commit comments

Comments
 (0)