3333dd41fa
* Entry points to introduce persistence in language selection * setLanguage action changes both the state and the i18next language * Ensure language change applies to all pages on load Co-authored-by: Andrew Nicolaou <me@andrewnicolaou.co.uk>
56 lines
1.2 KiB
JavaScript
56 lines
1.2 KiB
JavaScript
|
|
import React from 'react';
|
|
import { render } from '@testing-library/react';
|
|
|
|
|
|
import { NavComponent } from '../Nav';
|
|
|
|
describe('Nav', () => {
|
|
const props = {
|
|
newProject: jest.fn(),
|
|
saveProject: jest.fn(),
|
|
autosaveProject: jest.fn(),
|
|
exportProjectAsZip: jest.fn(),
|
|
cloneProject: jest.fn(),
|
|
user: {
|
|
authenticated: true,
|
|
username: 'new-user',
|
|
id: 'new-user'
|
|
},
|
|
project: {
|
|
id: 'new-project',
|
|
owner: {
|
|
id: 'new-user'
|
|
}
|
|
},
|
|
logoutUser: jest.fn(),
|
|
newFile: jest.fn(),
|
|
newFolder: jest.fn(),
|
|
showShareModal: jest.fn(),
|
|
showErrorModal: jest.fn(),
|
|
unsavedChanges: false,
|
|
warnIfUnsavedChanges: jest.fn(),
|
|
showKeyboardShortcutModal: jest.fn(),
|
|
cmController: {
|
|
tidyCode: jest.fn(),
|
|
showFind: jest.fn(),
|
|
findNext: jest.fn(),
|
|
findPrev: jest.fn()
|
|
},
|
|
startSketch: jest.fn(),
|
|
stopSketch: jest.fn(),
|
|
setAllAccessibleOutput: jest.fn(),
|
|
showToast: jest.fn(),
|
|
setToastText: jest.fn(),
|
|
rootFile: {
|
|
id: 'root-file'
|
|
},
|
|
t: jest.fn(),
|
|
setLanguage: jest.fn()
|
|
};
|
|
|
|
it('renders correctly', () => {
|
|
const { asFragment } = render(<NavComponent {...props} />);
|
|
expect(asFragment()).toMatchSnapshot();
|
|
});
|
|
});
|