Skip to content

Commit

Permalink
Clean up. Fix lint error and unexpected chars.
Browse files Browse the repository at this point in the history
  • Loading branch information
IllusionMH committed Oct 2, 2018
1 parent d3fb2f3 commit 7385beb
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/tests/NoRelativeImportsRuleTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ describe('noRelativeImportsRule', () : void => {

it('should pass on absolute path ES6 imports', () : void => {
const script : string = `
import OfficeApp from 'OfficeApp';
import OfficeApp from 'common/OfficeApp';
import OfficeApp from 'OfficeApp';
import OfficeApp from 'common/OfficeApp';
`;

TestHelper.assertViolations(ruleName, script, [ ]);
Expand All @@ -33,40 +33,40 @@ describe('noRelativeImportsRule', () : void => {

TestHelper.assertViolations(ruleName, script, [
{
"failure": "External module is being loaded from a relative path. Please use an absolute path: require('./App')",
"name": "file.ts",
"ruleName": "no-relative-imports",
"startPosition": { "character": 26, "line": 2 }
failure: 'External module is being loaded from a relative path. Please use an absolute path: require(\'./App\')',
name: 'file.ts',
ruleName: 'no-relative-imports',
startPosition: { character: 26, line: 2 }
},
{
"failure": "External module is being loaded from a relative path. Please use an absolute path: require('../common/App')",
"name": "file.ts",
"ruleName": "no-relative-imports",
"startPosition": { "character": 26, "line": 3 }
failure: 'External module is being loaded from a relative path. Please use an absolute path: require(\'../common/App\')',
name: 'file.ts',
ruleName: 'no-relative-imports',
startPosition: { character: 26, line: 3 }
}
]);
});

it('should fail on relative path ES6 import', () : void => {
const script : string = `
import OfficeApp from './OfficeApp';
import OfficeApp from '../common/OfficeApp';
import OfficeApp from './OfficeApp';
import OfficeApp from '../common/OfficeApp';
`;

TestHelper.assertViolations(ruleName, script, [
{
"failure": "Imported module is being loaded from a relative path. " +
"Please use an absolute path: import OfficeApp from './OfficeApp';",
"name": "file.ts",
"ruleName": "no-relative-imports",
"startPosition": { "character": 14, "line": 2 }
failure: 'Imported module is being loaded from a relative path. ' +
'Please use an absolute path: import OfficeApp from \'./OfficeApp\';',
name: 'file.ts',
ruleName: 'no-relative-imports',
startPosition: { character: 13, line: 2 }
},
{
"failure": "Imported module is being loaded from a relative path. " +
"Please use an absolute path: import OfficeApp from '../common/OfficeApp';",
"name": "file.ts",
"ruleName": "no-relative-imports",
"startPosition": { "character": 14, "line": 3 }
failure: 'Imported module is being loaded from a relative path. ' +
'Please use an absolute path: import OfficeApp from \'../common/OfficeApp\';',
name: 'file.ts',
ruleName: 'no-relative-imports',
startPosition: { character: 13, line: 3 }
}
]);
});
Expand Down

0 comments on commit 7385beb

Please sign in to comment.