-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mocha): allow vue-router creation using mocha (#127)
* fix(#119): allow routes vue-router creation through routes param from both jest and mocha * add test to check vue-router require for mocha users
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import '@testing-library/jest-dom' | ||
import {render} from '@testing-library/vue' | ||
|
||
import About from './components/Router/About.vue' | ||
|
||
const routes = [] | ||
test('uses require("vue-router").default when require("vue-router") is undefined (useful for mocha users)', () => { | ||
// Test for fix https://github.com/testing-library/vue-testing-library/issues/119 | ||
jest.mock('vue-router', () => { | ||
return undefined | ||
}) | ||
|
||
expect(() => render(About, {routes})).toThrowError( | ||
new TypeError("Cannot read property 'default' of undefined"), | ||
) | ||
}) |
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