2018-10-28 01:22:54 +02:00
|
|
|
|
|
|
|
import React from 'react';
|
2020-06-28 15:05:33 +02:00
|
|
|
import { render } from '@testing-library/react';
|
2018-10-28 01:22:54 +02:00
|
|
|
|
2020-06-28 15:05:33 +02:00
|
|
|
|
|
|
|
import { NavComponent } from '../Nav';
|
2018-10-28 01:22:54 +02:00
|
|
|
|
|
|
|
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(),
|
2019-02-10 01:45:29 +01:00
|
|
|
newFile: jest.fn(),
|
|
|
|
newFolder: jest.fn(),
|
2018-10-28 01:22:54 +02:00
|
|
|
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(),
|
2019-10-08 23:46:11 +02:00
|
|
|
setAllAccessibleOutput: jest.fn(),
|
|
|
|
showToast: jest.fn(),
|
|
|
|
setToastText: jest.fn(),
|
|
|
|
rootFile: {
|
|
|
|
id: 'root-file'
|
2020-07-06 11:36:45 +02:00
|
|
|
},
|
|
|
|
t: jest.fn()
|
2018-10-28 01:22:54 +02:00
|
|
|
};
|
2018-10-28 02:48:57 +02:00
|
|
|
|
|
|
|
it('renders correctly', () => {
|
2020-06-28 15:05:33 +02:00
|
|
|
const { asFragment } = render(<NavComponent {...props} />);
|
|
|
|
expect(asFragment()).toMatchSnapshot();
|
2018-10-28 02:48:57 +02:00
|
|
|
});
|
2018-10-28 01:22:54 +02:00
|
|
|
});
|