Skip to content

Commit f3dbf26

Browse files
committed
fix(test): address review feedback
- Fix mock.module(import('path')) → mock.module('path') (4 files) - Restore uuidv4.mockClear() in SuperConverter test for isolation - Add EditorConstructor.mockClear() in SuperInput beforeEach
1 parent d8d5ac6 commit f3dbf26

6 files changed

Lines changed: 9 additions & 6 deletions

File tree

packages/super-editor/src/components/SuperInput.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ const Wrapper = defineComponent({
3030
});
3131

3232
describe('SuperInput.vue', () => {
33-
beforeEach(() => {});
33+
beforeEach(() => {
34+
EditorConstructor.mockClear();
35+
});
3436

3537
it('uses the local content element for each instance', async () => {
3638
mount(Wrapper);

packages/super-editor/src/core/commands/changeListLevel.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mock.module('@helpers/list-numbering-helpers.js', () => ({
66
},
77
}));
88

9-
mock.module(import('@helpers/index.js'), async (importOriginal) => {
9+
mock.module('@helpers/index.js', async (importOriginal) => {
1010
const actual = await importOriginal();
1111
return {
1212
...actual,

packages/super-editor/src/core/commands/removeNumberingProperties.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { removeNumberingProperties } = await import('./removeNumberingProperties.
55
import { decreaseListIndent } from './decreaseListIndent.js';
66
import { updateNumberingProperties } from './changeListLevel.js';
77

8-
mock.module(import('../helpers/findParentNode.js'), async (importOriginal) => {
8+
mock.module('../helpers/findParentNode.js', async (importOriginal) => {
99
const actual = await importOriginal();
1010
return {
1111
...actual,

packages/super-editor/src/core/commands/restartNumbering.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { findParentNode } = await import('@helpers/index.js');
55
import { isList } from '@core/commands/list-helpers';
66
import { ListHelpers } from '@helpers/list-numbering-helpers.js';
77

8-
mock.module(import('@helpers/index.js'), async (importOriginal) => {
8+
mock.module('@helpers/index.js', async (importOriginal) => {
99
const actual = await importOriginal();
1010
return {
1111
...actual,

packages/super-editor/src/core/super-converter/SuperConverter.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ describe('SuperConverter Document GUID', () => {
452452
await converter.getDocumentIdentifier();
453453
expect(converter.getDocumentGuid()).toBe('test-uuid-1234');
454454

455-
// Clear the mock to verify promoteToGuid doesn't generate a new one
455+
// Clear call history to verify promoteToGuid doesn't generate a new one
456+
uuidv4.mockClear();
456457
// promoteToGuid should return the existing GUID
457458
const guid = converter.promoteToGuid();
458459
expect(guid).toBe('test-uuid-1234');

packages/super-editor/src/tests/toolbar/updateToolbarState.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mock.module('@extensions/linked-styles/linked-styles.js', () => ({
1919
getQuickFormatList: mock(),
2020
}));
2121

22-
mock.module(import('@helpers/index.js'), async (importOriginal) => {
22+
mock.module('@helpers/index.js', async (importOriginal) => {
2323
const actual = await importOriginal();
2424
return {
2525
...actual,

0 commit comments

Comments
 (0)