Skip to content

Commit

Permalink
Refactoring #25
Browse files Browse the repository at this point in the history
* Add `exists` function in tests
  • Loading branch information
VovanR committed Dec 27, 2015
1 parent ae0ae35 commit b97d2f5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
10 changes: 9 additions & 1 deletion test/cli-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ var assert = require('chai').assert;
var fs = require('fs');
var path = require('path');
var tempfile = require('tempfile');
var exists = fs.existsSync || path.existsSync;
var execa = require('execa');

function exists(pathName) {
try {
fs.statSync(pathName);
return true;
} catch (err) {
return false;
}
}

var FN = path.join(process.cwd(), 'bin', 'bemstyla.js');
var TEMP_DIR = tempfile();
fs.mkdirSync(TEMP_DIR);
Expand Down
17 changes: 12 additions & 5 deletions test/creator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,26 @@ var _ = require('lodash');
var yaml = require('js-yaml');
var fs = require('fs');
var path = require('path');
var exists = fs.existsSync || path.existsSync;

var testData = yaml.safeLoad(fs.readFileSync('./test/fixtures/format-file-test-cases.yml', 'utf8'));

var TEMP_DIR = '/tmp/bemstyla';
/**
*/
var clearTemp = function () {

function clearTemp() {
mockfs.restore();
var mockData = {};
mockData[TEMP_DIR] = {};
mockfs(mockData);
};
}

function exists(pathName) {
try {
fs.statSync(pathName);
return true;
} catch (err) {
return false;
}
}

describe('creator', function () {
it('should be `Object`', function () {
Expand Down

0 comments on commit b97d2f5

Please sign in to comment.