Skip to content

Commit 1e53e09

Browse files
takaokoujiclaude
andcommitted
fix: resolve unit test failures in theme mocking
- Replace file-based mocks with inline Jest mocks to avoid module name conflicts - Update themes.test.js and monitor.test.jsx to use proper inline mock definitions - Remove physical __mocks__ directories that were causing Jest duplication warnings - Ensure tests use expected mock values instead of actual theme values Fixes unit tests that were failing due to mock configuration issues after upstream merge integration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3fa675b commit 1e53e09

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed

test/unit/components/monitor.test.jsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,23 @@ import DefaultMonitor from '../../../src/components/monitor/default-monitor';
44
import Monitor from '../../../src/components/monitor/monitor';
55
import {DARK_THEME, DEFAULT_THEME} from '../../../src/lib/themes';
66

7-
jest.mock('../../../src/lib/themes/default');
8-
jest.mock('../../../src/lib/themes/dark');
7+
jest.mock('../../../src/lib/themes/default', () => ({
8+
blockColors: {
9+
motion: {
10+
primary: '#111111'
11+
},
12+
text: '#444444'
13+
}
14+
}));
15+
16+
jest.mock('../../../src/lib/themes/dark', () => ({
17+
blockColors: {
18+
motion: {
19+
primary: '#AAAAAA'
20+
},
21+
text: '#BBBBBB'
22+
}
23+
}));
924

1025
describe('Monitor Component', () => {
1126
test('it selects the correct colors based on default theme', () => {

test/unit/util/themes.test.js

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,41 @@ import {
88
import {injectExtensionBlockTheme, injectExtensionCategoryTheme} from '../../../src/lib/themes/blockHelpers';
99
import {detectTheme, persistTheme} from '../../../src/lib/themes/themePersistance';
1010

11-
jest.mock('../../../src/lib/themes/default');
12-
jest.mock('../../../src/lib/themes/dark');
11+
jest.mock('../../../src/lib/themes/default', () => ({
12+
blockColors: {
13+
motion: {
14+
primary: '#111111',
15+
secondary: '#222222',
16+
tertiary: '#333333'
17+
},
18+
pen: {
19+
primary: '#121212',
20+
secondary: '#232323',
21+
tertiary: '#343434'
22+
},
23+
text: '#444444',
24+
workspace: '#555555'
25+
}
26+
}));
27+
28+
jest.mock('../../../src/lib/themes/dark', () => ({
29+
blockColors: {
30+
motion: {
31+
primary: '#AAAAAA'
32+
},
33+
pen: {
34+
primary: '#FFFFFF',
35+
secondary: '#EEEEEE',
36+
tertiary: '#DDDDDD'
37+
},
38+
text: '#BBBBBB'
39+
},
40+
extensions: {
41+
pen: {
42+
blockIconURI: 'darkPenIcon'
43+
}
44+
}
45+
}));
1346

1447
describe('themes', () => {
1548
let serializeToString;

0 commit comments

Comments
 (0)