Skip to content

Commit 9c2f168

Browse files
committed
test(extensions): simplify example setup for autofix tests
1 parent d51f400 commit 9c2f168

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/rules/extensions.spec.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -175,65 +175,65 @@ ruleTester.run('extensions', rule, {
175175
invalid: [
176176
tInvalid({
177177
name: 'extensions should autofix by default',
178-
code: 'import a from "a/foo.js"',
178+
code: 'import a from "./foo.js"',
179179
options: ['never'],
180180
errors: [
181181
{
182182
messageId: 'unexpected',
183-
data: { extension: 'js', importPath: 'a/foo.js' },
183+
data: { extension: 'js', importPath: './foo.js' },
184184
line: 1,
185185
column: 15,
186186
},
187187
],
188-
output: 'import a from "a/foo"',
188+
output: 'import a from "./foo"',
189189
}),
190190
tInvalid({
191191
name: 'extensions should autofix when fix is set to true',
192-
code: 'import a from "a/foo.js"',
192+
code: 'import a from "./foo.js"',
193193
options: ['never', {fix: true}],
194194
errors: [
195195
{
196196
messageId: 'unexpected',
197-
data: { extension: 'js', importPath: 'a/foo.js' },
197+
data: { extension: 'js', importPath: './foo.js' },
198198
line: 1,
199199
column: 15,
200200
},
201201
],
202-
output: 'import a from "a/foo"',
202+
output: 'import a from "./foo"',
203203
}),
204204
tInvalid({
205205
name: 'extensions should autofix when fix is set to true and a pattern object is provided',
206-
code: 'import a from "a/foo.js"',
206+
code: 'import a from "./foo.js"',
207207
options: ['never', {fix: true, pattern: {}}],
208208
errors: [
209209
{
210210
messageId: 'unexpected',
211-
data: { extension: 'js', importPath: 'a/foo.js' },
211+
data: { extension: 'js', importPath: './foo.js' },
212212
line: 1,
213213
column: 15,
214214
},
215215
],
216-
output: 'import a from "a/foo"',
216+
output: 'import a from "./foo"',
217217
}),
218218
tInvalid({
219219
name: 'extensions should not autofix when fix is set to false',
220-
code: 'import a from "a/foo.js"',
220+
code: 'import a from "./foo.js"',
221221
options: ['never', {fix: false}],
222222
errors: [
223223
{
224224
messageId: 'unexpected',
225-
data: { extension: 'js', importPath: 'a/foo.js' },
225+
data: { extension: 'js', importPath: './foo.js' },
226226
line: 1,
227227
column: 15,
228228
suggestions: [
229229
{
230230
messageId: 'removeUnexpected',
231231
data: {
232232
extension: 'js',
233-
importPath: 'a/foo.js',
234-
fixedImportPath: 'a/foo',
233+
importPath: './foo.js',
234+
fixedImportPath: './foo',
235235
},
236-
output: 'import a from "a/foo"',
236+
output: 'import a from "./foo"',
237237
},
238238
],
239239
},

0 commit comments

Comments
 (0)