Skip to content

Commit 5075192

Browse files
committed
Add more tests
1 parent 25580a1 commit 5075192

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

tests/lib/utils/vue-component.js

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,63 @@ ruleTester.run('return-in-computed-property', rule, {
7676
filename: 'test.js',
7777
code: `Vue.component('async-example', function (resolve, reject) { })`,
7878
parserOptions
79+
},
80+
{
81+
filename: 'test.vue',
82+
code: `export const a = { }`,
83+
parserOptions
84+
},
85+
{
86+
filename: 'test.vue',
87+
code: `foo({ })`,
88+
parserOptions
89+
},
90+
{
91+
filename: 'test.vue',
92+
code: `foo(() => { return {} })`,
93+
parserOptions
94+
},
95+
{
96+
filename: 'test.jsx',
97+
code: `Vue.component('async-example', function (resolve, reject) { })`,
98+
parserOptions
99+
},
100+
{
101+
filename: 'test.jsx',
102+
code: `export const a = { }`,
103+
parserOptions
104+
},
105+
{
106+
filename: 'test.jsx',
107+
code: `foo({ })`,
108+
parserOptions
109+
},
110+
{
111+
filename: 'test.jsx',
112+
code: `foo(() => { return {} })`,
113+
parserOptions
114+
},
115+
{
116+
filename: 'test.js',
117+
code: `new Vue({ })`,
118+
parserOptions
119+
},
120+
{
121+
filename: 'test.jsx',
122+
code: `new Vue({ })`,
123+
parserOptions
124+
},
125+
{
126+
filename: 'test.vue',
127+
code: `new Vue({ })`,
128+
parserOptions
79129
}
80130
],
81131
invalid: [
82132
{
83-
filename: 'test.js',
133+
filename: 'test.vue',
84134
code: `Vue.component('async-example', function (resolve, reject) {
135+
// @vue/component
85136
resolve({})
86137
})`,
87138
parserOptions,
@@ -99,6 +150,12 @@ ruleTester.run('return-in-computed-property', rule, {
99150
parserOptions,
100151
errors: [makeError(1)]
101152
},
153+
{
154+
filename: 'test.jsx',
155+
code: `export default { }`,
156+
parserOptions,
157+
errors: [makeError(1)]
158+
},
102159
{
103160
filename: 'test.js',
104161
code: `// @vue/component

0 commit comments

Comments
 (0)