forked from strongloop/loopback-boot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.test.js
33 lines (29 loc) · 999 Bytes
/
utils.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// 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
'use strict';
var utils = require('../lib/utils');
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');
expect(utils.fileExistsSync(doesNotExist))
.to.equal(false);
});
it('returns true when a file does exist', function() {
var doesExist = appdir.writeConfigFileSync('does-exist.json', {
exists: true,
});
expect(utils.fileExistsSync(doesExist))
.to.equal(true);
});
});
});