-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sthzg
committed
Jul 7, 2016
1 parent
44decc0
commit f591388
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,54 @@ | ||
'use strict'; | ||
|
||
const after = require('mocha').after; | ||
const before = require('mocha').before; | ||
const describe = require('mocha').describe; | ||
const it = require('mocha').it; | ||
|
||
const chai = require('chai').assert; | ||
const fs = require('fs'); | ||
const mockfs = require('mock-fs'); | ||
const path = require('path'); | ||
const tHelpers = require('../_helpers'); | ||
const utils = require('../../utils/utils'); | ||
|
||
|
||
describe('getInstalledPkgPaths()', () => { | ||
describe('getInstalledPkgPaths()', function () { | ||
before(function() { | ||
mockfs(tHelpers.mockedDirsForSearchPaths.structure); | ||
}); | ||
|
||
it('returns expected number of directories from the fs', function () { | ||
const res = utils.getInstalledPkgPaths(tHelpers.mockedDirsForSearchPaths.roots); | ||
chai.isOk(res.length === 6, 'Expected number of dirs to be 6') | ||
}); | ||
|
||
after(function() { | ||
mockfs.restore(); | ||
}); | ||
}); | ||
}); | ||
|
||
|
||
describe('populatePkgStoreFromPaths()', () => { | ||
describe('populatePkgStoreFromPaths()', function () { | ||
before(function() { | ||
mockfs(tHelpers.mockedDirsForSearchPaths.structure); | ||
this.pkgPaths = utils.getInstalledPkgPaths(tHelpers.mockedDirsForSearchPaths.roots); | ||
}); | ||
|
||
it('returns expected number of directories from the fs', function () { | ||
const res = utils.populatePkgStoreFromPaths(this.pkgPaths); | ||
chai.isOk(res.length === 6, 'Expected number of entries to be 6'); | ||
chai.isOk( | ||
res.every(x => typeof x.path === 'string' && x.path !== ''), | ||
'Expected all items to have a non-empty path prop ' | ||
); | ||
}); | ||
|
||
after(function() { | ||
mockfs.restore(); | ||
}); | ||
}); | ||
}); |