Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d94523d

Browse files
committed
Add tests for deprecation warning
1 parent fe7f00d commit d94523d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

‎src/__tests__/deprecated-options.js‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import {render} from '..'
2+
3+
beforeEach(() => {
4+
jest.spyOn(console, 'warn').mockImplementation(() => {})
5+
})
6+
7+
afterEach(() => {
8+
console.warn.mockRestore()
9+
})
10+
11+
test('warns on deprecated store option', () => {
12+
const Component = {template: `<div></div>`}
13+
14+
render(Component, {
15+
store: 'anything',
16+
})
17+
18+
expect(console.warn).toHaveBeenCalledTimes(1)
19+
expect(console.warn).toHaveBeenCalledWith(
20+
expect.stringContaining(
21+
`Providing 'store' or 'routes' options is now deprecated`,
22+
),
23+
)
24+
})
25+
26+
test('warns on deprecated routes option', () => {
27+
const Component = {template: `<div></div>`}
28+
29+
render(Component, {
30+
routes: 'anything',
31+
})
32+
33+
expect(console.warn).toHaveBeenCalledTimes(1)
34+
expect(console.warn).toHaveBeenCalledWith(
35+
expect.stringContaining(
36+
`Providing 'store' or 'routes' options is now deprecated`,
37+
),
38+
)
39+
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /