2016-08-10 22:34:11 +00:00
|
|
|
// Copyright IBM Corp. 2014,2016. All Rights Reserved.
|
|
|
|
// Node module: loopback-boot
|
|
|
|
// This file is licensed under the MIT License.
|
|
|
|
// License text available at https://opensource.org/licenses/MIT
|
|
|
|
|
2016-04-27 22:55:57 +00:00
|
|
|
var utils = require('../lib/utils');
|
2016-08-10 22:34:11 +00:00
|
|
|
var expect = require('chai').expect;
|
|
|
|
var sandbox = require('./helpers/sandbox');
|
|
|
|
var appdir = require('./helpers/appdir');
|
|
|
|
|
|
|
|
describe('utils', function() {
|
|
|
|
beforeEach(sandbox.reset);
|
|
|
|
beforeEach(function(done) {
|
|
|
|
appdir.init(done);
|
|
|
|
});
|
|
|
|
describe('fileExistsSync', function() {
|
|
|
|
it('returns false when a file does not exist', function() {
|
|
|
|
var doesNotExist = sandbox.resolve('does-not-exist.json');
|
2016-04-27 22:55:57 +00:00
|
|
|
expect(utils.fileExistsSync(doesNotExist))
|
2016-08-10 22:34:11 +00:00
|
|
|
.to.equal(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns true when a file does exist', function() {
|
|
|
|
var doesExist = appdir.writeConfigFileSync('does-exist.json', {
|
|
|
|
exists: true,
|
|
|
|
});
|
2016-04-27 22:55:57 +00:00
|
|
|
expect(utils.fileExistsSync(doesExist))
|
2016-08-10 22:34:11 +00:00
|
|
|
.to.equal(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|