Skip to content

Commit 3afafdd

Browse files
César Albercaeddyerburgh
authored andcommitted
types: improve types for mocks and provide in config options (#875)
1 parent 13bcaeb commit 3afafdd

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

docs/api/config.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ Example:
5656
```js
5757
import { config } from '@vue/test-utils'
5858

59-
config.methods['errors'] = () => {
60-
any: () => false
61-
}
59+
config.methods['getData'] = () => {}
6260
```
6361

6462
### `provide`

docs/ja/api/config.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ config.mocks['$store'] = {
5555
```js
5656
import { config } from '@vue/test-utils'
5757

58-
config.methods['errors'] = () => {
59-
any: () => false
60-
}
58+
config.methods['getData'] = () => {}
6159
```
6260

6361
#### `provide`

docs/ru/api/config.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ config.mocks['$store'] = {
5656
```js
5757
import { config } from '@vue/test-utils'
5858

59-
config.methods['errors'] = () => {
60-
any: () => false
61-
}
59+
config.methods['getData'] = () => {}
6260
```
6361

6462
### `provide`

docs/zh/api/config.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ config.mocks['$store'] = {
5656
```js
5757
import { config } from '@vue/test-utils'
5858

59-
config.methods['errors'] = () => {
60-
any: () => false
61-
}
59+
config.methods['getData'] = () => {}
6260
```
6361

6462
### `provide`

packages/test-utils/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ type ThisTypedShallowMountOptions<V extends Vue> = ShallowMountOptions<V> & This
143143

144144
interface VueTestUtilsConfigOptions {
145145
stubs?: Record<string, Component | boolean | string>
146-
mocks?: object
146+
mocks?: Record<string, any>
147147
methods?: Record<string, Function>
148-
provide?: object,
148+
provide?: Record<string, any>,
149149
logModifiedComponents?: Boolean
150150
silent?: Boolean
151151
}

packages/test-utils/types/test/mount.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const normalFoo: string = normalWrapper.vm.foo
1212
const classWrapper = mount(ClassComponent)
1313
const classFoo: string = classWrapper.vm.bar
1414

15-
const functinalWrapper = mount(functionalOptions)
15+
const functionalWrapper = mount(functionalOptions)
1616

1717
/**
1818
* Test for mount options
@@ -83,15 +83,23 @@ config.stubs = {
8383
qux: `<div>Test</div>`,
8484
quux: true
8585
}
86+
config.stubs['quuux'] = true
8687
config.mocks = {
8788
foo: 'bar',
8889
}
90+
config.mocks['foo'] = {
91+
bar: 'baz'
92+
}
8993
config.methods = {
9094
foo: () => {}
9195
}
96+
config.methods['foo'] = () => true
9297
config.provide = {
9398
foo: {}
9499
}
100+
config.provide['foo'] = {
101+
bar: {}
102+
}
95103
config.logModifiedComponents = true
96104
config.silent = true
97105

0 commit comments

Comments
 (0)