Skip to content

Commit

Permalink
chore: Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
phated authored and actions-user committed Jul 24, 2021
1 parent 00f5968 commit 17c98f4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function getLongExtension(basename) {
return null;
}

var startIndex = (basename[0] === '.') ? 1 : 0;
var startIndex = basename[0] === '.' ? 1 : 0;

var dotIndex = basename.indexOf('.', startIndex);
if (dotIndex <= startIndex) {
Expand Down
13 changes: 10 additions & 3 deletions test/extension.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var expect = require('expect');
var extension = require('../lib/extension');

describe('Take out possible extensions from a file path', function () {

it('should return an extension: ".js" from "app.js"', function (done) {
expect(extension('app.js')).toEqual(['.js']);
expect(extension('a/b/c/app.js')).toEqual(['.js']);
Expand All @@ -18,8 +17,16 @@ describe('Take out possible extensions from a file path', function () {
});

it('should return extensions: ".aaa.bbb.ccc", ".aaa.bbb" and ".ccc" from "app.aaa.bbb.ccc"', function (done) {
expect(extension('app.aaa.bbb.ccc')).toEqual(['.aaa.bbb.ccc', '.bbb.ccc', '.ccc']);
expect(extension('a/b/c/app.aaa.bbb.ccc')).toEqual(['.aaa.bbb.ccc', '.bbb.ccc', '.ccc']);
expect(extension('app.aaa.bbb.ccc')).toEqual([
'.aaa.bbb.ccc',
'.bbb.ccc',
'.ccc',
]);
expect(extension('a/b/c/app.aaa.bbb.ccc')).toEqual([
'.aaa.bbb.ccc',
'.bbb.ccc',
'.ccc',
]);
done();
});

Expand Down
12 changes: 6 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@ describe('rechoir', function () {

it('should register a module loader even if the extension is single character (issue #38)', function (done) {
var fpath = path.join(__dirname, 'fixtures', 'test.s');
rechoir.prepare({
'.s': [
'nothere',
'../require-stub',
],
}, fpath);
rechoir.prepare(
{
'.s': ['nothere', '../require-stub'],
},
fpath
);

expect(function () {
require(fpath);
Expand Down

0 comments on commit 17c98f4

Please sign in to comment.