Skip to content

Commit 3db9992

Browse files
committed
fix(gui): add missing locales state to sprite-selector-item test
fix: resolve undefined locales.isRtl error in sprite-selector-item tests Add missing locales state to test mock store and fix DeleteConfirmationPrompt mock path. The component's mapStateToProps was trying to access state.locales.isRtl which was undefined.
1 parent 8d6b781 commit 3db9992

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

packages/scratch-gui/test/unit/containers/sprite-selector-item.test.jsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import DeleteButton from '../../../src/components/delete-button/delete-button';
99
import {legacyConfig} from '../../../src/legacy-config';
1010
import DeleteConfirmationPrompt from '../../../src/containers/delete-confirmation-prompt';
1111

12-
jest.mock('../../../src/components/delete-confirmation-prompt/delete-confirmation-prompt.jsx', () => jest.fn(() => null));
12+
jest.mock('../../../src/containers/delete-confirmation-prompt', () => jest.fn(() => null));
1313
describe('SpriteSelectorItem Container', () => {
1414
const mockStore = configureStore();
1515
let className;
@@ -52,12 +52,18 @@ describe('SpriteSelectorItem Container', () => {
5252
dispatchSetHoveredSprite = jest.fn();
5353
selected = true;
5454
vm = new VM();
55-
store = mockStore({scratchGui: {
56-
config: legacyConfig,
57-
hoveredTarget: {receivedBlocks: false, sprite: null},
58-
assetDrag: {dragging: false},
59-
vm
60-
}});
55+
store = mockStore({
56+
scratchGui: {
57+
config: legacyConfig,
58+
hoveredTarget: {receivedBlocks: false, sprite: null},
59+
assetDrag: {dragging: false},
60+
vm
61+
},
62+
locales: {
63+
isRtl: false,
64+
locale: 'en-US'
65+
}
66+
});
6167
});
6268

6369
test('should delete the sprite, when called without `withDeleteConfirmation`', () => {

0 commit comments

Comments
 (0)