Skip to content

Commit

Permalink
added case-insensitivity tests for default/named (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmosher committed Aug 23, 2016
1 parent 6e3b530 commit d5af34e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/src/rules/default.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { test, SYNTAX_CASES } from '../utils'
import { RuleTester } from 'eslint'

import { CASE_SENSITIVE_FS } from 'eslint-module-utils/resolve'

var ruleTester = new RuleTester()
, rule = require('rules/default')

Expand Down Expand Up @@ -65,6 +67,7 @@ ruleTester.run('default', rule, {
parser: 'babel-eslint',
}),


...SYNTAX_CASES,
],

Expand Down Expand Up @@ -114,3 +117,20 @@ ruleTester.run('default', rule, {
}),
],
})

// #311: import of mismatched case
if (!CASE_SENSITIVE_FS) {
ruleTester.run('default (path case-insensitivity)', rule, {
valid: [
test({
code: 'import foo from "./jsx/MyUncoolComponent.jsx"',
}),
],
invalid: [
test({
code: 'import bar from "./Named-Exports"',
errors: ['No default export found in module.'],
}),
],
})
}
20 changes: 20 additions & 0 deletions tests/src/rules/named.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { test, SYNTAX_CASES } from '../utils'
import { RuleTester } from 'eslint'

import { CASE_SENSITIVE_FS } from 'eslint-module-utils/resolve'


var ruleTester = new RuleTester()
, rule = require('rules/named')

Expand Down Expand Up @@ -211,3 +214,20 @@ ruleTester.run('named', rule, {
}),
],
})

// #311: import of mismatched case
if (!CASE_SENSITIVE_FS) {
ruleTester.run('named (path case-insensitivity)', rule, {
valid: [
test({
code: 'import { b } from "./Named-Exports"',
}),
],
invalid: [
test({
code: 'import { foo } from "./Named-Exports"',
errors: [`foo not found in './Named-Exports'`],
}),
],
})
}

0 comments on commit d5af34e

Please sign in to comment.