skypager-project
Version:
skypager project framework
108 lines (88 loc) • 3.67 kB
JavaScript
import Skypager from '.'
describe('Skypager Project', function () {
before(function() {
if (!this.project) {
this.project = Skypager.load(process.cwd(), {
sync: false
})
}
})
it('has an instance id', function() {
this.project.should.have.property('id')
})
it('Can load collections synchronously', function() {
this.project.should.have.property('collection')
this.project.should.have.property('files').that.is.an('array')
this.project.files.should.not.be.empty
})
it('loads the manifest', function() {
this.project.should.have.property('manifest')
this.project.manifest.should.have.property('name', 'skypager-project')
this.project.manifest.should.have.property('dependencies').that.is.an('object')
})
it('uses manifest configuration values for the project options', function() {
this.project.options.should.have.property('main', 'skypager.js')
})
it('enhances the pick method', function() {
const obj = this.project.slice('manifest.skypager', 'cacheKey', 'cwd')
obj.should.be.an('object')
obj.should.have.property('manifest').that.is.an('object').that.has.a.property('skypager').that.is.not.empty
obj.should.have.property('cacheKey', this.project.cacheKey)
obj.should.have.property('cwd', this.project.realCwd)
})
it('creates enhanced entity objects using the slice method', function() {
const obj = this.project.createEntityFrom('manifest.dependencies', 'cwd', 'helpers.available', 'compilers.available')
obj.should.be.an('object')
obj.should.have.property('helpers').that.is.an('object').that.has.a.property('available')
.that.is.an('array').that.is.not.empty
obj.should.have.property('manifest').that.is.an('object').that.has.a.property('dependencies')
.that.is.not.empty
obj.should.have.property('hide').that.is.a('function')
})
})
describe('helpers', function() {
before(function(){
this.project = Skypager.load(process.cwd(), {
sync: true
})
})
it('has a bunch of helpers', function() {
this.project.helpers.available.should.include('project-type')
this.project.should.have.property('projectType').that.is.a('function')
this.project.should.have.property('projectTypes').that.is.an('object')
})
})
describe('Project Info', function(){
before(function(){
this.project = Skypager.load(process.cwd(), {
sync: true
})
})
it('tells you about the project based on what it finds in the manifest', function() {
const project = this.project
project.should.have.property('manifest')
project.get('manifest.name').should.equal('skypager-project')
project.get('manifest.devDependencies').should.be.an('object').that.is.not.empty
})
it('has a selectors system', function() {
const project = this.project
project.select('dependencies').should.be.an('object').that.is.not.empty
})
it('has identifying features', function() {
const project = this.project
project.should.have.property('id').that.is.not.empty
project.should.have.property('name').that.is.not.empty
project.should.have.property('namespace').that.is.not.empty
})
it('lists info about the file paths', function() {
this.project.should.have.property('subFolderNames').that.contains('src')
let names = this.project.subFolderNames
names.should.include('src/middlewares')
})
it('lists info about the file paths', function() {
this.project.should.have.property('childFolderNames').that.contains('src')
let names = this.project.childFolderNames
names.should.not.contain('node_modules')
names.should.contain('src')
})
})