forked from processing/p5.js-web-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add jest/enzyme and a simple unit test
- Loading branch information
Showing
7 changed files
with
20,234 additions
and
7,797 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import Nav 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(), | ||
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() | ||
}; | ||
const getWrapper = () => shallow(<Nav {...props} />); | ||
|
||
test('it renders main navigation', () => { | ||
const nav = getWrapper(); | ||
expect(nav.exists('.nav')).toEqual(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { configure } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
|
||
configure({ adapter: new Adapter() }) |
Oops, something went wrong.