Skip to content

Commit

Permalink
Refactor: Rename getFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
nick spragg committed Jan 18, 2017
1 parent c77bed4 commit 6ad1c3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class File {
});
}

getFilesSync() {
getListSync() {
if (this.isDirectorySync()) {
return fs.readdirSync(this._pathname).map((file) => {
return path.join(this._pathname, file);
Expand All @@ -82,7 +82,7 @@ class File {
return null;
}

getFiles() {
getList() {
return this.isDirectory()
.then((isDirectory) => {
if (isDirectory) {
Expand Down
12 changes: 6 additions & 6 deletions test/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ describe('File', () => {
});
});

describe('.getFilesSync', () => {
describe('.getListSync', () => {
it('returns a list of files for a given directory', () => {
const file = File.create(getFixturePath('/justFiles'));
const files = file.getFilesSync();
const files = file.getListSync();
const expected = qualifyNames([
'justFiles/a.json',
'justFiles/b.json',
Expand All @@ -91,15 +91,15 @@ describe('File', () => {

it('returns null when pathname is not a directory', () => {
const file = File.create(getFixturePath('/justFiles/a.json'));
const files = file.getFilesSync();
const files = file.getListSync();
assert.strictEqual(files, null);
});
});

describe('.getFiles', () => {
describe('.getList', () => {
it('returns a list of files for a given directory', () => {
const file = File.create(getFixturePath('/justFiles'));
const files = file.getFiles();
const files = file.getList();
const expected = qualifyNames([
'justFiles/a.json',
'justFiles/b.json',
Expand All @@ -114,7 +114,7 @@ describe('File', () => {

it('returns null when pathname is not a directory', () => {
const file = File.create(getFixturePath('/justFiles/a.json'));
const files = file.getFiles();
const files = file.getList();
files.then((list) => {
assert.strictEqual(list, null);
});
Expand Down

0 comments on commit 6ad1c3c

Please sign in to comment.